{"id":20038533,"url":"https://github.com/yahoo/yql-plus","last_synced_at":"2025-10-24T23:12:45.698Z","repository":{"id":14486206,"uuid":"76505423","full_name":"yahoo/yql-plus","owner":"yahoo","description":"The YQL+ parser, execution engine, and source SDK.","archived":false,"fork":false,"pushed_at":"2023-03-21T04:34:40.000Z","size":1363,"stargazers_count":41,"open_issues_count":10,"forks_count":14,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-05T06:37:26.508Z","etag":null,"topics":["query-language","yql","yql-parser"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yahoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-14T23:24:01.000Z","updated_at":"2025-01-07T01:01:33.000Z","dependencies_parsed_at":"2024-11-13T10:40:32.836Z","dependency_job_id":null,"html_url":"https://github.com/yahoo/yql-plus","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/yahoo/yql-plus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fyql-plus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fyql-plus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fyql-plus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fyql-plus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yahoo","download_url":"https://codeload.github.com/yahoo/yql-plus/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yahoo%2Fyql-plus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280878822,"owners_count":26406739,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["query-language","yql","yql-parser"],"created_at":"2024-11-13T10:29:49.330Z","updated_at":"2025-10-24T23:12:45.658Z","avatar_url":"https://github.com/yahoo.png","language":"Java","funding_links":[],"categories":["大数据"],"sub_categories":["微服务框架"],"readme":"[![Build Status](https://travis-ci.org/yahoo/yql-plus.svg?branch=master)](https://travis-ci.org/yahoo/yql-plus)\n\n# YQL+ Engine\n\nThis is the YQL+ parser, execution engine, and source SDK.\n\n## Modules\n\n- yqlplus_language - YQL+ grammar and parser\n\n  An ANTLRv4-based parser for the YQL+ grammar (see docs/language.md) which parses programs into \n  \"OperatorNodes\" -- an AST representation of a YQL+ program consisting of OperatorNodes of different types \n  of operators:\n  \n  - `StatementOperator`  - The top-level PROGRAM as well as argument declarations, view statements, queries, etc.\n   - `SequenceOperators`  - Represents queries. Logically produces a sequence of records, includes operators like PROJECT, FILTER, SCAN\n   - `ExpressionOperator` - Represents an expression -- used to represent projection expressions, filters, sorts, etc. \n   - `SortOperator`       - Represents ASC and DESC operators on sort expressions.\n   - `ProjectOperator`    - Operations in a projection -- FIELD, FLATTEN (SELECT a.* ...)\n\n- yqlplus_engine -- YQL+ execution engine\n\n  This is the engine implementation. It has APIs for turning a stream or file into a `CompiledProgram` which is the interface for executing a program and getting results.\n\n- yqlplus_source_api -- Source annotations and interfaces\n\n This module defines the API for writing sources, transforms (pipes), and UDFs. It contains interfaces for tagging an implementation of each as well as annotations for communicating binding information to the engine.\n\n Guice Multibindings are used to publish these implementations to the engine with names.\n\n\n## Usage\n\n- YQL+ language parser\n```java     \nProgramParser parser = new ProgramParser();\nparser.parse(\"query\", \n             \"PROGRAM (@uuid string,\n                       @logo_type string=\"\"); \n              SELECT p.id,\n                     p.provider_id, \n                     p.provider_name,\n                     p.provider_alias,  \n                    {\"name\" : plogo.name, \"image\" :  plogo.image} logo\n              FROM provider({}) AS p \n              LEFT JOIN provider_logo(@logo_type,{}) AS plogo \n              ON p.id = plogo.provider_id  \n              WHERE p.id=@uuid\n              OUTPUT AS provider;\");\n``` \n- Query a Data `Source`\n \n    (1) Create a Data `Source`\n```\n  public class InnerSource implements Source {\n      @Query\n      @TimeoutBudget(minimumMilliseconds = 5, maximumMilliseconds = 100)\n      public List\u003cPerson\u003e scan(@TimeoutMilliseconds long timeoutMs) {\n        Assert.assertTrue(timeoutMs \u003c= 100, \"timeoutBudget \u003c= 100\");\n        // checking minimum is dodgy and leads to failures\n        return ImmutableList.of(new Person(\"1\", \"joe\", 1));\n      }\n\n      @Query\n      public Person lookup(@Key(\"id\") String id) {\n        if (\"1\".equals(id)) {\n            return new Person(\"1\", \"joe\", 1);\n        } else if (\"3\".equals(id)) {\n            return new Person(\"3\", \"smith\", 1);\n        } else {\n            return null;\n        }\n      }\n\n      @Query\n      public Person lookup(@Key(\"iid\") Integer id) {\n        return lookup(String.valueOf(id));\n      }\n  }\n```\n\n   \n  (2) Bind `Source` instance\n```java\npublic class JavaTestModule extends AbstractModule {\n   @Override\n    protected void configure() {\n        install(new JavaEngineModule());\n        MapBinder\u003cString, Source\u003e sourceBindings = MapBinder.newMapBinder(binder(), String.class, Source.class);\n        sourceBindings.addBinding(\"innersource\").to(InnerSource.class);\n    }\n}\n```\n   \n  (3) Create `Program` to query the Data `Source`\n \n```java\nInjector injector = Guice.createInjector(new JavaTestModule());\nYQLPlusCompiler compiler = injector.getInstance(YQLPlusCompiler.class);\nCompiledProgram program = compiler.compile(\"SELECT * FROM innersource WHERE id = '1' OUTPUT AS b1;\");\nProgramResult myResult = program.run(ImmutableMap.\u003cString, Object\u003eof(), true);\nYQLResultSet b1 = myResult.getResult(\"b1\").get();\nList\u003cPerson\u003e b1r = b1.getResult();\n \n```\n\n\n- Import Java function to YQL+ `Program`\n\n  (1) Create an `Export` class \n```\n  public class DateTime implements Exports {\n\n      @Export\n      public Instant from_epoch_second(long epochSecond) {\n          return Instant.ofEpochSecond(epochSecond);\n      }\n  }\n```\n\n   \n  (2) Bind `Export` class\n```java\npublic class StandardLibraryModule extends AbstractModule {\n\n    @Override\n    protected void configure() {\n        MapBinder\u003cString, Exports\u003e exportsBindings = MapBinder.newMapBinder(binder(), String.class, Exports.class);\n        exportsBindings.addBinding(\"datetime\").to(DateTime.class);\n    }\n}\n```\n   \n  (3) Use the `Export` function in `Program`\n \n```java\nYQLPlusCompiler compiler = injector.getInstance(YQLPlusCompiler.class);\nCompiledProgram program = compiler.compile(\"SELECT datetime.from_epoch_second(1378489457) date OUTPUT AS d1;\");\nProgramResult result = program.run(ImmutableMap.\u003cString, Object\u003eof(), false);\nList\u003cRecord\u003e f2 = result.getResult(\"d1\").get().getResult();\n```\n\n## Maven\n\n```xml\n   \n   \u003cdependency\u003e\n      \u003cgroupId\u003ecom.yahoo.yqlplus\u003c/groupId\u003e\n      \u003cartifactId\u003eyqlplus_engine\u003c/artifactId\u003e\n      \u003cversion\u003e1.0.1\u003c/version\u003e\n   \u003c/dependency\u003e\n   ...\n   \u003cdependency\u003e   \n      \u003cgroupId\u003ecom.yahoo.yqlplus\u003c/groupId\u003e\n      \u003cartifactId\u003eyqlplus_source_api\u003c/artifactId\u003e\n      \u003cversion\u003e$1.0.1\u003c/version\u003e\n   \u003c/dependency\u003e\n   ...\n   \u003cdependency\u003e   \n      \u003cgroupId\u003ecom.yahoo.yqlplus\u003c/groupId\u003e\n      \u003cartifactId\u003eyqlplus_language\u003c/artifactId\u003e\n      \u003cversion\u003e$1.0.1\u003c/version\u003e\n   \u003c/dependency\u003e \n   ...\n   \u003cdependency\u003e\n      \u003cgroupId\u003ecom.yahoo.yqlplus\u003c/groupId\u003e\n      \u003cartifactId\u003eyqlplus_stdlib\u003c/artifactId\u003e\n      \u003cversion\u003e1.0.1\u003c/version\u003e\n   \u003c/dependency\u003e\n   ...\n   \u003crepositories\u003e\n      \u003crepository\u003e\n        \u003csnapshots\u003e\n          \u003cenabled\u003efalse\u003c/enabled\u003e\n        \u003c/snapshots\u003e\n        \u003cid\u003ebintray-yahoo-maven\u003c/id\u003e\n        \u003cname\u003ebintray\u003c/name\u003e\n        \u003curl\u003ehttp://yahoo.bintray.com/maven\u003c/url\u003e\n      \u003c/repository\u003e\n   \u003c/repositories\u003e\n```\n\n\n\n## LICENSE\n\nCopyright 2016 Yahoo Inc.\n\nLicensed under the terms of the Apache version 2.0 license. See [LICENSE](/LICENSE) file for terms.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fyql-plus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyahoo%2Fyql-plus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyahoo%2Fyql-plus/lists"}