Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract source table names from mv query #854

Merged
merged 8 commits into from
Oct 31, 2024

Conversation

seankao-az
Copy link
Collaborator

@seankao-az seankao-az commented Oct 31, 2024

Description

Extract source table names from mv query and add to _meta.properties.sourceTables

This is actually already introduced in #297, but we used it only for validation and didn't store the table names

Example

CREATE MATERIALIZED VIEW myglue_test.default.mv_test_source_tables
AS SELECT status FROM myglue_test.default.http_logs
WITH (
  auto_refresh = true,
  checkpoint_location = 's3://test/'
)

GET flint_myglue_test_default_mv_test_source_tables/_mappings
{
  "flint_myglue_test_default_mv_test_source_tables": {
    "mappings": {
      "_meta": {
        "latestId": "ZmxpbnRfbXlnbHVlX3Rlc3RfZGVmYXVsdF9tdl90ZXN0X3NvdXJjZV90YWJsZXM=",
        "kind": "mv",
        "indexedColumns": [
          {
            "columnType": "int",
            "columnName": "status"
          }
        ],
        "name": "myglue_test.default.mv_test_source_tables",
        "options": {
          "auto_refresh": "true",
          "refresh_interval": "5 minutes",
          "scheduler_mode": "external",
          "incremental_refresh": "false",
          "checkpoint_location": "s3://test/"
        },
        "source": "SELECT status FROM myglue_test.default.http_logs",
        "version": "0.6.0",
        "properties": {
          "sourceTables": [
            "myglue_test.default.http_logs"
          ],
          "env": {
            "SERVERLESS_EMR_VIRTUAL_CLUSTER_ID": "****",
            "SERVERLESS_EMR_JOB_ID": "****"
          }
        }
      },
      "properties": {
        "status": {
          "type": "integer"
        }
      }
    }
  }
}

Related Issues

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@seankao-az seankao-az self-assigned this Oct 31, 2024
@seankao-az seankao-az changed the title Parse source tables from mv query Extract source table names from mv query Oct 31, 2024
@seankao-az seankao-az marked this pull request as ready for review October 31, 2024 17:09
Signed-off-by: Sean Kao <[email protected]>
@seankao-az seankao-az merged commit 950009b into opensearch-project:main Oct 31, 2024
4 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 31, 2024
* add sourceTables to MV index metadata properties

Signed-off-by: Sean Kao <[email protected]>

* parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* test cases for parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* use constant for metadata cache version

Signed-off-by: Sean Kao <[email protected]>

* write source tables to metadata cache

Signed-off-by: Sean Kao <[email protected]>

* address comment

Signed-off-by: Sean Kao <[email protected]>

* generate source tables for old mv without new prop

Signed-off-by: Sean Kao <[email protected]>

* syntax fix

Signed-off-by: Sean Kao <[email protected]>

---------

Signed-off-by: Sean Kao <[email protected]>
(cherry picked from commit 950009b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
seankao-az pushed a commit that referenced this pull request Nov 1, 2024
* add sourceTables to MV index metadata properties



* parse source tables from mv query



* test cases for parse source tables from mv query



* use constant for metadata cache version



* write source tables to metadata cache



* address comment



* generate source tables for old mv without new prop



* syntax fix



---------


(cherry picked from commit 950009b)

Signed-off-by: Sean Kao <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
YANG-DB added a commit that referenced this pull request Nov 2, 2024
* update antlr grammar for (future) P1 command syntax

Signed-off-by: YANGDB <[email protected]>

* add trendline command

Signed-off-by: YANGDB <[email protected]>

* add expand command

Signed-off-by: YANGDB <[email protected]>

* add geoip command

Signed-off-by: YANGDB <[email protected]>

* PPl `flatten` command (#784)

* The flatten command implemented

Signed-off-by: Lukasz Soszynski <[email protected]>

* The flatten command integration tests were extended with additional checks for logical plans.

Signed-off-by: Lukasz Soszynski <[email protected]>

* flatten, added more tests related to plan translation and integration tests

Signed-off-by: Lukasz Soszynski <[email protected]>

* Flatten command added to command names list.

Signed-off-by: Lukasz Soszynski <[email protected]>

---------

Signed-off-by: Lukasz Soszynski <[email protected]>

* Extract source table names from mv query (#854)

* add sourceTables to MV index metadata properties

Signed-off-by: Sean Kao <[email protected]>

* parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* test cases for parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* use constant for metadata cache version

Signed-off-by: Sean Kao <[email protected]>

* write source tables to metadata cache

Signed-off-by: Sean Kao <[email protected]>

* address comment

Signed-off-by: Sean Kao <[email protected]>

* generate source tables for old mv without new prop

Signed-off-by: Sean Kao <[email protected]>

* syntax fix

Signed-off-by: Sean Kao <[email protected]>

---------

Signed-off-by: Sean Kao <[email protected]>

* Fallback to internal scheduler when index creation failed (#850)

* Fallback to internal scheduler when index creation failed

Signed-off-by: Louis Chu <[email protected]>

* Fix IT

Signed-off-by: Louis Chu <[email protected]>

* Fix IOException

Signed-off-by: Louis Chu <[email protected]>

---------

Signed-off-by: Louis Chu <[email protected]>

* New trendline ppl command (SMA only) (#833)

* WIP trendline command

Signed-off-by: Kacper Trochimiak <[email protected]>

* wip

Signed-off-by: Kacper Trochimiak <[email protected]>

* trendline supports sorting

Signed-off-by: Kacper Trochimiak <[email protected]>

* run scalafmtAll

Signed-off-by: Kacper Trochimiak <[email protected]>

* return null when there are too few data points

Signed-off-by: Kacper Trochimiak <[email protected]>

* sbt scalafmtAll

Signed-off-by: Kacper Trochimiak <[email protected]>

* Remove WMA references

Signed-off-by: Hendrik Saly <[email protected]>

* trendline - sortByField as Optional<Field>

Signed-off-by: Kacper Trochimiak <[email protected]>

* introduce TrendlineStrategy

Signed-off-by: Kacper Trochimiak <[email protected]>

* keywordsCanBeId -> replace SMA with trendlineType

Signed-off-by: Kacper Trochimiak <[email protected]>

* handle trendline alias as qualifiedName instead of fieldExpression

Signed-off-by: Kacper Trochimiak <[email protected]>

* Add docs

Signed-off-by: Hendrik Saly <[email protected]>

* Make alias optional

Signed-off-by: Hendrik Saly <[email protected]>

* Adapt tests for optional alias

Signed-off-by: Hendrik Saly <[email protected]>

* Adden logical plan unittests

Signed-off-by: Hendrik Saly <[email protected]>

* Add missing license headers

Signed-off-by: Hendrik Saly <[email protected]>

* Fix docs

Signed-off-by: Hendrik Saly <[email protected]>

* numberOfDataPoints must be 1 or greater

Signed-off-by: Hendrik Saly <[email protected]>

* Rename TrendlineStrategy to  TrendlineCatalystUtils

Signed-off-by: Hendrik Saly <[email protected]>

* Validate TrendlineType early and pass around enum type

Signed-off-by: Hendrik Saly <[email protected]>

* Add trendline chaining test

Signed-off-by: Hendrik Saly <[email protected]>

* Fix compile errors

Signed-off-by: Hendrik Saly <[email protected]>

* Fix imports

Signed-off-by: Hendrik Saly <[email protected]>

* Fix imports

Signed-off-by: Hendrik Saly <[email protected]>

---------

Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Co-authored-by: Kacper Trochimiak <[email protected]>

* update iplocation antlr

Signed-off-by: YANGDB <[email protected]>

---------

Signed-off-by: YANGDB <[email protected]>
Signed-off-by: Lukasz Soszynski <[email protected]>
Signed-off-by: Sean Kao <[email protected]>
Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Co-authored-by: lukasz-soszynski-eliatra <[email protected]>
Co-authored-by: Sean Kao <[email protected]>
Co-authored-by: Louis Chu <[email protected]>
Co-authored-by: Hendrik Saly <[email protected]>
Co-authored-by: Kacper Trochimiak <[email protected]>
YANG-DB added a commit that referenced this pull request Nov 5, 2024
* update antlr grammar for (future) P1 command syntax

Signed-off-by: YANGDB <[email protected]>

* add trendline command

Signed-off-by: YANGDB <[email protected]>

* add expand command

Signed-off-by: YANGDB <[email protected]>

* add geoip command

Signed-off-by: YANGDB <[email protected]>

* PPl `flatten` command (#784)

* The flatten command implemented

Signed-off-by: Lukasz Soszynski <[email protected]>

* The flatten command integration tests were extended with additional checks for logical plans.

Signed-off-by: Lukasz Soszynski <[email protected]>

* flatten, added more tests related to plan translation and integration tests

Signed-off-by: Lukasz Soszynski <[email protected]>

* Flatten command added to command names list.

Signed-off-by: Lukasz Soszynski <[email protected]>

---------

Signed-off-by: Lukasz Soszynski <[email protected]>

* Extract source table names from mv query (#854)

* add sourceTables to MV index metadata properties

Signed-off-by: Sean Kao <[email protected]>

* parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* test cases for parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* use constant for metadata cache version

Signed-off-by: Sean Kao <[email protected]>

* write source tables to metadata cache

Signed-off-by: Sean Kao <[email protected]>

* address comment

Signed-off-by: Sean Kao <[email protected]>

* generate source tables for old mv without new prop

Signed-off-by: Sean Kao <[email protected]>

* syntax fix

Signed-off-by: Sean Kao <[email protected]>

---------

Signed-off-by: Sean Kao <[email protected]>

* Fallback to internal scheduler when index creation failed (#850)

* Fallback to internal scheduler when index creation failed

Signed-off-by: Louis Chu <[email protected]>

* Fix IT

Signed-off-by: Louis Chu <[email protected]>

* Fix IOException

Signed-off-by: Louis Chu <[email protected]>

---------

Signed-off-by: Louis Chu <[email protected]>

* New trendline ppl command (SMA only) (#833)

* WIP trendline command

Signed-off-by: Kacper Trochimiak <[email protected]>

* wip

Signed-off-by: Kacper Trochimiak <[email protected]>

* trendline supports sorting

Signed-off-by: Kacper Trochimiak <[email protected]>

* run scalafmtAll

Signed-off-by: Kacper Trochimiak <[email protected]>

* return null when there are too few data points

Signed-off-by: Kacper Trochimiak <[email protected]>

* sbt scalafmtAll

Signed-off-by: Kacper Trochimiak <[email protected]>

* Remove WMA references

Signed-off-by: Hendrik Saly <[email protected]>

* trendline - sortByField as Optional<Field>

Signed-off-by: Kacper Trochimiak <[email protected]>

* introduce TrendlineStrategy

Signed-off-by: Kacper Trochimiak <[email protected]>

* keywordsCanBeId -> replace SMA with trendlineType

Signed-off-by: Kacper Trochimiak <[email protected]>

* handle trendline alias as qualifiedName instead of fieldExpression

Signed-off-by: Kacper Trochimiak <[email protected]>

* Add docs

Signed-off-by: Hendrik Saly <[email protected]>

* Make alias optional

Signed-off-by: Hendrik Saly <[email protected]>

* Adapt tests for optional alias

Signed-off-by: Hendrik Saly <[email protected]>

* Adden logical plan unittests

Signed-off-by: Hendrik Saly <[email protected]>

* Add missing license headers

Signed-off-by: Hendrik Saly <[email protected]>

* Fix docs

Signed-off-by: Hendrik Saly <[email protected]>

* numberOfDataPoints must be 1 or greater

Signed-off-by: Hendrik Saly <[email protected]>

* Rename TrendlineStrategy to  TrendlineCatalystUtils

Signed-off-by: Hendrik Saly <[email protected]>

* Validate TrendlineType early and pass around enum type

Signed-off-by: Hendrik Saly <[email protected]>

* Add trendline chaining test

Signed-off-by: Hendrik Saly <[email protected]>

* Fix compile errors

Signed-off-by: Hendrik Saly <[email protected]>

* Fix imports

Signed-off-by: Hendrik Saly <[email protected]>

* Fix imports

Signed-off-by: Hendrik Saly <[email protected]>

---------

Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Co-authored-by: Kacper Trochimiak <[email protected]>

* update iplocation antlr

Signed-off-by: YANGDB <[email protected]>

* update scala fmt style

Signed-off-by: YANGDB <[email protected]>

* `cidrmatch` ppl command add logical tests and docs (#865)

* update logical tests and docs

Signed-off-by: YANGDB <[email protected]>

* update scala fmt style

Signed-off-by: YANGDB <[email protected]>

* fix type error

Signed-off-by: YANGDB <[email protected]>

---------

Signed-off-by: YANGDB <[email protected]>

* Support Lambda and add related array functions (#864)

* json function enhancement

Signed-off-by: Heng Qian <[email protected]>

* Add JavaToScalaTransformer

Signed-off-by: Heng Qian <[email protected]>

* Apply scalafmtAll

Signed-off-by: Heng Qian <[email protected]>

* Address comments

Signed-off-by: Heng Qian <[email protected]>

* Add IT and change to use the same function name as spark

Signed-off-by: Heng Qian <[email protected]>

* Address comments

Signed-off-by: Heng Qian <[email protected]>

* Add document and separate lambda functions from json functions

Signed-off-by: Heng Qian <[email protected]>

* Add lambda functions transform and reduce

Signed-off-by: Heng Qian <[email protected]>

* polish lambda function document

Signed-off-by: Heng Qian <[email protected]>

* polish lambda function document

Signed-off-by: Heng Qian <[email protected]>

* Minor fix

Signed-off-by: Heng Qian <[email protected]>

* Minor change to polish the documents

Signed-off-by: Heng Qian <[email protected]>

---------

Signed-off-by: Heng Qian <[email protected]>

---------

Signed-off-by: YANGDB <[email protected]>
Signed-off-by: Lukasz Soszynski <[email protected]>
Signed-off-by: Sean Kao <[email protected]>
Signed-off-by: Louis Chu <[email protected]>
Signed-off-by: Kacper Trochimiak <[email protected]>
Signed-off-by: Hendrik Saly <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Co-authored-by: lukasz-soszynski-eliatra <[email protected]>
Co-authored-by: Sean Kao <[email protected]>
Co-authored-by: Louis Chu <[email protected]>
Co-authored-by: Hendrik Saly <[email protected]>
Co-authored-by: Kacper Trochimiak <[email protected]>
Co-authored-by: qianheng <[email protected]>
kenrickyap pushed a commit to Bit-Quill/opensearch-spark that referenced this pull request Dec 11, 2024
* add sourceTables to MV index metadata properties

Signed-off-by: Sean Kao <[email protected]>

* parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* test cases for parse source tables from mv query

Signed-off-by: Sean Kao <[email protected]>

* use constant for metadata cache version

Signed-off-by: Sean Kao <[email protected]>

* write source tables to metadata cache

Signed-off-by: Sean Kao <[email protected]>

* address comment

Signed-off-by: Sean Kao <[email protected]>

* generate source tables for old mv without new prop

Signed-off-by: Sean Kao <[email protected]>

* syntax fix

Signed-off-by: Sean Kao <[email protected]>

---------

Signed-off-by: Sean Kao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants