├── qinsql-main ├── etc │ ├── catalog │ │ ├── memory.properties │ │ ├── tpcds.properties │ │ ├── iceberg.properties │ │ ├── druid.properties │ │ ├── mysql.properties │ │ ├── sqlserver.properties │ │ ├── postgresql.properties │ │ ├── jmx.properties │ │ ├── blackhole.properties │ │ ├── pinot.properties │ │ ├── tpch.properties │ │ ├── hive.properties │ │ ├── example.properties │ │ ├── localfile.properties │ │ └── raptor.properties │ ├── access-control.properties │ ├── jvm.config │ ├── function-namespace │ │ └── example.properties.example │ └── log.properties └── src │ ├── test │ ├── resources │ │ ├── catalog_allow_unset.json │ │ ├── catalog_invalid_allow_value.json │ │ ├── security-config-file-with-unknown-rules.json │ │ ├── queue_config_bad_selfcycle.json │ │ ├── queue_config_bad_out_degree.json │ │ ├── file-based-system-access-schema.json │ │ ├── catalog_principal.json │ │ ├── catalog.json │ │ ├── catalog_read_only.json │ │ └── queue_config_bad_cycle.json │ └── java │ │ └── com │ │ └── facebook │ │ └── presto │ │ ├── type │ │ ├── TestDate.java │ │ ├── TestTime.java │ │ ├── TestDateLegacy.java │ │ └── TestTimeLegacy.java │ │ ├── sql │ │ └── planner │ │ │ ├── assertions │ │ │ └── PlanTestSymbol.java │ │ │ ├── TestingConnectorIndexHandle.java │ │ │ └── TestingConnectorTransactionHandle.java │ │ └── operator │ │ ├── aggregation │ │ ├── TestBooleanMaxAggregation.java │ │ └── TestBooleanMinAggregation.java │ │ └── scalar │ │ ├── TestJoniRegexpFunctions.java │ │ └── TestRe2jRegexpFunctions.java │ └── main │ ├── resources │ └── webapp │ │ ├── assets │ │ ├── logo.png │ │ └── favicon.ico │ │ ├── src │ │ ├── .flowconfig │ │ ├── embedded_plan.jsx │ │ ├── query.jsx │ │ ├── stage.jsx │ │ ├── plan.jsx │ │ ├── index.jsx │ │ ├── worker.jsx │ │ ├── package.json │ │ └── webpack.config.js │ │ └── vendor │ │ ├── vis │ │ └── dist │ │ │ └── img │ │ │ ├── network │ │ │ ├── plus.png │ │ │ ├── cross.png │ │ │ ├── cross2.png │ │ │ ├── minus.png │ │ │ ├── backIcon.png │ │ │ ├── downArrow.png │ │ │ ├── editIcon.png │ │ │ ├── leftArrow.png │ │ │ ├── upArrow.png │ │ │ ├── addNodeIcon.png │ │ │ ├── connectIcon.png │ │ │ ├── deleteIcon.png │ │ │ ├── rightArrow.png │ │ │ ├── zoomExtends.png │ │ │ └── acceptDeleteIcon.png │ │ │ └── timeline │ │ │ └── delete.png │ │ └── bootstrap │ │ └── fonts │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ └── glyphicons-halflings-regular.woff2 │ └── java │ └── com │ └── facebook │ └── presto │ ├── tdigest │ └── docs │ │ ├── tdigest.png │ │ └── tdigest_centroids.png │ ├── type │ └── khyperloglog │ │ └── docs │ │ └── khll_layout.png │ ├── sql │ ├── gen │ │ └── lambda │ │ │ ├── LambdaFunctionInterface.java │ │ │ ├── UnaryFunctionInterface.java │ │ │ └── BinaryFunctionInterface.java │ ├── analyzer │ │ └── RegexLibrary.java │ └── planner │ │ ├── planPrinter │ │ └── Renderer.java │ │ └── VariableResolver.java │ ├── server │ ├── ShutdownAction.java │ ├── NodeResourceStatusProvider.java │ ├── SimpleHttpResponseCallback.java │ ├── DefaultShutdownAction.java │ ├── SessionSupplier.java │ ├── security │ │ └── RoleType.java │ └── ServiceUnavailableException.java │ ├── operator │ ├── LocalPlannerAware.java │ ├── PipelineExecutionStrategy.java │ ├── aggregation │ │ ├── histogram │ │ │ ├── HistogramGroupImplementation.java │ │ │ └── HistogramValueReader.java │ │ ├── arrayagg │ │ │ ├── ArrayAggGroupImplementation.java │ │ │ └── ArrayAggregationStateConsumer.java │ │ ├── multimapagg │ │ │ ├── MultimapAggGroupImplementation.java │ │ │ └── MultimapAggregationStateConsumer.java │ │ ├── approxmostfrequent │ │ │ ├── BucketConsumer.java │ │ │ ├── ApproximateMostFrequentBucketSerializer.java │ │ │ └── ApproximateMostFrequentBucketDeserializer.java │ │ ├── state │ │ │ ├── RegressionState.java │ │ │ ├── LongState.java │ │ │ ├── DoubleState.java │ │ │ ├── BooleanDistinctState.java │ │ │ └── CorrelationState.java │ │ ├── BlockComparator.java │ │ └── minmaxby │ │ │ ├── LongAndBlockPositionValueState.java │ │ │ ├── DoubleAndBlockPositionValueState.java │ │ │ ├── BooleanAndBlockPositionValueState.java │ │ │ ├── LongLongState.java │ │ │ ├── DoubleLongState.java │ │ │ ├── LongDoubleState.java │ │ │ ├── BooleanLongState.java │ │ │ ├── LongBooleanState.java │ │ │ ├── SliceAndBlockPositionValueState.java │ │ │ ├── DoubleDoubleState.java │ │ │ ├── BooleanDoubleState.java │ │ │ ├── DoubleBooleanState.java │ │ │ ├── BlockAndBlockPositionValueState.java │ │ │ └── BooleanBooleanState.java │ ├── PagesIndexComparator.java │ ├── PartitionFunction.java │ ├── OuterPositionIterator.java │ ├── ExchangeClientSupplier.java │ ├── PageWithPositionComparator.java │ ├── InternalJoinFilterFunction.java │ ├── ParametricImplementation.java │ ├── scalar │ │ ├── LongToBooleanFunction.java │ │ ├── DoubleToBooleanFunction.java │ │ ├── BooleanToBooleanFunction.java │ │ ├── SliceToBooleanFunction.java │ │ └── BlockToBooleanFunction.java │ ├── JoinFilterFunction.java │ ├── UpdateMemory.java │ └── BlockedReason.java │ ├── statusservice │ └── NodeStatusService.java │ ├── execution │ ├── warnings │ │ ├── WarningHandlingLevel.java │ │ └── WarningCollectorFactory.java │ ├── QueryPerformanceFetcher.java │ ├── scheduler │ │ ├── ExecutionPolicy.java │ │ ├── ExecutionSchedule.java │ │ └── OutputBufferManager.java │ └── resourceGroups │ │ └── Queue.java │ ├── cost │ ├── CostProvider.java │ └── StatsProvider.java │ ├── util │ └── JsonCastException.java │ ├── dispatcher │ └── CoordinatorLocation.java │ ├── resourcemanager │ ├── ClusterStatusSender.java │ └── MemoryManagerService.java │ ├── metadata │ ├── RemoteNodeState.java │ ├── BuiltInFunction.java │ ├── TablePropertyManager.java │ ├── ColumnPropertyManager.java │ ├── SchemaPropertyManager.java │ └── AnalyzePropertyManager.java │ └── memory │ └── VoidTraversingQueryContextVisitor.java ├── qinsql-plugin-toolkit └── src │ └── test │ └── resources │ ├── invalid.json │ ├── schema.json │ ├── session_property.json │ └── table.json ├── README.md ├── .gitignore ├── qinsql-engine └── src │ └── main │ └── resources │ └── META-INF │ └── services │ ├── org.lealone.sql.SQLEngine │ └── org.lealone.server.ProtocolServerEngine ├── qinsql-local-file └── src │ ├── test │ └── resources │ │ ├── example-gzipped-data │ │ └── http-request.log.gz │ │ └── example-data │ │ └── http-request.log │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── localfile │ └── LocalFileTransactionHandle.java ├── qinsql-testng-services └── src │ └── main │ └── resources │ └── META-INF │ └── services │ └── org.testng.ITestNGListener ├── qinsql-common └── src │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── common │ ├── type │ ├── encoding │ │ └── README │ ├── VariableWidthType.java │ ├── TDigestType.java │ ├── EnumType.java │ ├── QuantileDigestType.java │ └── ParametricType.java │ ├── block │ └── LazyBlockLoader.java │ ├── predicate │ ├── AllOrNone.java │ └── DiscreteValues.java │ └── relation │ └── Predicate.java ├── qinsql-tpch └── src │ └── main │ ├── resources │ └── tpch │ │ └── statistics │ │ ├── sf3000.0 │ │ ├── README.txt │ │ ├── region.json │ │ ├── nation.json │ │ └── partsupp.json │ │ ├── sf0.01 │ │ ├── region.json │ │ └── nation.json │ │ └── sf1.0 │ │ ├── region.json │ │ └── nation.json │ └── java │ └── com │ └── facebook │ └── presto │ └── tpch │ └── TpchTransactionHandle.java ├── qinsql-test └── src │ └── test │ └── java │ └── org │ └── qinsql │ └── test │ └── QinEngineStart.java ├── qinsql-parser └── src │ ├── test │ └── resources │ │ └── tpch │ │ └── queries │ │ ├── 6.sql │ │ ├── 17.sql │ │ ├── 14.sql │ │ ├── 13.sql │ │ ├── 4.sql │ │ ├── 3.sql │ │ ├── 5.sql │ │ ├── 18.sql │ │ ├── 16.sql │ │ ├── 11.sql │ │ ├── 1.sql │ │ ├── 10.sql │ │ ├── 15.sql │ │ ├── 12.sql │ │ ├── 20.sql │ │ ├── 9.sql │ │ ├── 22.sql │ │ ├── 21.sql │ │ └── 2.sql │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── sql │ └── tree │ ├── RoutineBody.java │ └── SelectItem.java ├── qinsql-spi └── src │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── spi │ ├── ConnectorIndexHandle.java │ ├── ConnectorTableHandle.java │ ├── storage │ ├── TempStorageHandle.java │ ├── StorageCapabilities.java │ └── TempStorageFactory.java │ ├── security │ ├── PrincipalType.java │ ├── Privilege.java │ ├── TokenAuthenticator.java │ ├── SystemAccessControlFactory.java │ └── PasswordAuthenticatorFactory.java │ ├── ErrorCodeSupplier.java │ ├── connector │ ├── ConnectorTransactionHandle.java │ ├── ConnectorCapabilities.java │ ├── ConnectorPartitionHandle.java │ ├── ConnectorPartitioningHandle.java │ └── ConnectorOutputMetadata.java │ ├── statistics │ ├── TableStatisticType.java │ └── ColumnStatisticType.java │ ├── WarningCodeSupplier.java │ ├── function │ ├── AccumulatorState.java │ ├── FunctionKind.java │ ├── FunctionNamespaceTransactionHandle.java │ ├── FunctionHandleResolver.java │ ├── FunctionMetadataManager.java │ ├── ScalarFunctionImplementation.java │ ├── GroupedAccumulatorState.java │ ├── SqlFunction.java │ ├── IsNull.java │ ├── FunctionNamespaceManagerFactory.java │ ├── BlockIndex.java │ └── BlockPosition.java │ ├── ConnectorIndex.java │ ├── ConnectorInsertTableHandle.java │ ├── ConnectorOutputTableHandle.java │ ├── resourceGroups │ ├── ResourceGroupState.java │ ├── SchedulingPolicy.java │ ├── SessionPropertyConfigurationManagerContext.java │ └── ResourceGroupConfigurationManagerFactory.java │ ├── relation │ └── DeterminismEvaluator.java │ ├── schedule │ └── NodeSelectionStrategy.java │ ├── RecordSet.java │ ├── PageIndexerFactory.java │ ├── eventlistener │ └── EventListenerFactory.java │ ├── memory │ └── ClusterMemoryPoolManager.java │ ├── plan │ └── PlanNodeIdAllocator.java │ ├── ConnectorTableLayoutHandle.java │ ├── prerequisites │ └── QueryPrerequisitesFactory.java │ ├── BucketFunction.java │ └── PageIndexer.java ├── qinsql-matching └── src │ └── test │ └── java │ └── com │ └── facebook │ └── presto │ └── matching │ └── example │ └── rel │ ├── Expression.java │ └── RelNode.java ├── qinsql-client └── src │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── client │ └── QueryData.java ├── qinsql-bytecode └── src │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── bytecode │ ├── debug │ └── DebugNode.java │ ├── instruction │ └── InstructionNode.java │ ├── control │ └── FlowControl.java │ ├── ByteCodeTooLargeException.java │ └── CompilationException.java ├── qinsql-geospatial-toolkit └── src │ └── main │ └── java │ └── com │ └── facebook │ └── presto │ └── geospatial │ └── rtree │ └── HasExtent.java └── qinsql-thrift-api └── src └── main └── java └── com └── facebook └── presto └── thrift └── api └── datatypes └── PrestoThriftColumnData.java /qinsql-main/etc/catalog/memory.properties: -------------------------------------------------------------------------------- 1 | connector.name=memory 2 | -------------------------------------------------------------------------------- /qinsql-main/etc/access-control.properties: -------------------------------------------------------------------------------- 1 | access-control.name=allow-all 2 | -------------------------------------------------------------------------------- /qinsql-plugin-toolkit/src/test/resources/invalid.json: -------------------------------------------------------------------------------- 1 | { "invalid": [] } 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QinSQL 2 | 面向单机与分布式 OLTP/OLAP 场景的可暂停的渐进式 SQL 引擎 (只用于研究) 3 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/tpcds.properties: -------------------------------------------------------------------------------- 1 | connector.name=tpcds 2 | tpcds.splits-per-node=4 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | *.jar 3 | 4 | .settings 5 | .classpath 6 | .project 7 | target 8 | test-output 9 | -------------------------------------------------------------------------------- /qinsql-engine/src/main/resources/META-INF/services/org.lealone.sql.SQLEngine: -------------------------------------------------------------------------------- 1 | org.qinsql.engine.sql.QinSQLEngine -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/iceberg.properties: -------------------------------------------------------------------------------- 1 | connector.name=iceberg 2 | hive.metastore.uri=thrift://localhost:9083 -------------------------------------------------------------------------------- /qinsql-engine/src/main/resources/META-INF/services/org.lealone.server.ProtocolServerEngine: -------------------------------------------------------------------------------- 1 | org.qinsql.engine.server.QinSQLServerEngine -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/druid.properties: -------------------------------------------------------------------------------- 1 | connector.name=druid 2 | druid.coordinator-url=http://localhost:8081 3 | druid.broker-url=http://localhost:8082 -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/catalog_allow_unset.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "catalog": "allowed-absent" 5 | } 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/assets/logo.png -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/mysql.properties: -------------------------------------------------------------------------------- 1 | connector.name=mysql 2 | connection-url=jdbc:mysql://mysql:13306 3 | connection-user=root 4 | connection-password=swarm 5 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/assets/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/assets/favicon.ico -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | [include] 4 | 5 | [libs] 6 | 7 | [lints] 8 | 9 | [options] 10 | 11 | [strict] 12 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/sqlserver.properties: -------------------------------------------------------------------------------- 1 | connector.name=sqlserver 2 | connection-url=jdbc:sqlserver://sqlserver 3 | connection-user=sa 4 | connection-password=SQLServerPass1 5 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/postgresql.properties: -------------------------------------------------------------------------------- 1 | connector.name=postgresql 2 | connection-url=jdbc:postgresql://postgres:15432/test 3 | connection-user=swarm 4 | connection-password=swarm 5 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/tdigest/docs/tdigest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/java/com/facebook/presto/tdigest/docs/tdigest.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/plus.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/cross.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/cross2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/cross2.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/minus.png -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/catalog_invalid_allow_value.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "catalog": "invalid-allow-value", 5 | "allow": "not-a-valid-value" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /qinsql-local-file/src/test/resources/example-gzipped-data/http-request.log.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-local-file/src/test/resources/example-gzipped-data/http-request.log.gz -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/backIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/backIcon.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/downArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/downArrow.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/editIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/editIcon.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/leftArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/leftArrow.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/upArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/upArrow.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/timeline/delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/timeline/delete.png -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/tdigest/docs/tdigest_centroids.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/java/com/facebook/presto/tdigest/docs/tdigest_centroids.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/addNodeIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/addNodeIcon.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/connectIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/connectIcon.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/deleteIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/deleteIcon.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/rightArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/rightArrow.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/zoomExtends.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/zoomExtends.png -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/type/khyperloglog/docs/khll_layout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/java/com/facebook/presto/type/khyperloglog/docs/khll_layout.png -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/acceptDeleteIcon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/vis/dist/img/network/acceptDeleteIcon.png -------------------------------------------------------------------------------- /qinsql-main/etc/jvm.config: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | -------------------------------------------------------------------------------- /qinsql-testng-services/src/main/resources/META-INF/services/org.testng.ITestNGListener: -------------------------------------------------------------------------------- 1 | com.facebook.presto.testng.services.LogTestDurationListener 2 | com.facebook.presto.testng.services.ReportMultiThreadedBeforeOrAfterMethod 3 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codefollower/Presto/HEAD/qinsql-main/src/main/resources/webapp/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/security-config-file-with-unknown-rules.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionProperties": [ 3 | { 4 | "user": "admin", 5 | "property": "max_split_size", 6 | "allow": true 7 | } 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/encoding/README: -------------------------------------------------------------------------------- 1 | The files in this module have been extracted and adapted from the org.apache.commons.codec package, 2 | to keep the dependency graph of presto-commons as simple as possible. 3 | -------------------------------------------------------------------------------- /qinsql-main/etc/function-namespace/example.properties.example: -------------------------------------------------------------------------------- 1 | function-namespace-manager.name=mysql 2 | database-url=jdbc:mysql://localhost:3306 3 | function-namespaces-table-name=example_function_namespaces 4 | functions-table-name=example_sql_functions 5 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf3000.0/README.txt: -------------------------------------------------------------------------------- 1 | This statistics are copied from from hive connector from TPCH schema with sf3000. 2 | So distinct values are not exact and also there are no min nor max values for char-based columns. 3 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/jmx.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=jmx 9 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/blackhole.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=blackhole 9 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/pinot.properties: -------------------------------------------------------------------------------- 1 | connector.name=pinot 2 | 3 | # Pinot controller endpoint 4 | pinot.controller-urls=localhost:9000 5 | 6 | # Enable Query Pinot streaming server for segment queries. 7 | # Requires Pinot version >= 0.6.0. 8 | # pinot.use-streaming-for-segment-queries=true 9 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/tpch.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=tpch 9 | tpch.splits-per-node=4 10 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/queue_config_bad_selfcycle.json: -------------------------------------------------------------------------------- 1 | { 2 | "queues": { 3 | "q1": { 4 | "maxConcurrent": 5, 5 | "maxQueued": 20 6 | } 7 | }, 8 | "rules": [ 9 | { 10 | "queues": [ 11 | "q1", 12 | "q1" 13 | ] 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /qinsql-local-file/src/test/resources/example-data/http-request.log: -------------------------------------------------------------------------------- 1 | 2016-05-02T10:35:17.424-07:00 127.0.0.1 POST /v1/memory null null 200 0 1000 10 null 2 | 2016-05-02T10:35:17.439-07:00 127.0.0.1 GET /v1/service/presto/general foo ffffffff-ffff-ffff-ffff-ffffffffffff 200 0 37 1094 a7229d56-5cbd-4e23-81ff-312ba6be0f12 3 | 4 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/hive.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=hive-hadoop2 9 | hive.metastore.uri=thrift://localhost:9083 10 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/example.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=example-http 9 | metadata-uri=http://s3.amazonaws.com/presto-example/v2/example-metadata.json 10 | -------------------------------------------------------------------------------- /qinsql-plugin-toolkit/src/test/resources/schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemas": [ 3 | { 4 | "schema": "secret", 5 | "owner": false 6 | }, 7 | { 8 | "user": "admin", 9 | "schema": ".*", 10 | "owner": true 11 | }, 12 | { 13 | "user": "bob", 14 | "schema": "bob", 15 | "owner": true 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/localfile.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=localfile 9 | presto-logs.http-request-log.location=var/log 10 | presto-logs.http-request-log.pattern=http-request.log* 11 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/embedded_plan.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {LivePlan} from "./components/LivePlan"; 4 | import {getFirstParameter} from "./utils"; 5 | 6 | ReactDOM.render( 7 | , 8 | document.getElementById('live-plan-container') 9 | ); 10 | -------------------------------------------------------------------------------- /qinsql-main/etc/log.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | com.facebook.presto=INFO 9 | com.sun.jersey.guice.spi.container.GuiceComponentProviderFactory=WARN 10 | com.ning.http.client=WARN 11 | com.facebook.presto.server.PluginManager=DEBUG 12 | -------------------------------------------------------------------------------- /qinsql-test/src/test/java/org/qinsql/test/QinEngineStart.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Lealone Database Group. 3 | * Licensed under the Server Side Public License, v 1. 4 | * Initial Developer: zhh 5 | */ 6 | package org.qinsql.test; 7 | 8 | import org.lealone.main.Lealone; 9 | 10 | public class QinEngineStart { 11 | 12 | public static void main(String[] args) { 13 | Lealone.main(args); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/query.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {QueryDetail} from "./components/QueryDetail"; 4 | import {PageTitle} from "./components/PageTitle"; 5 | 6 | ReactDOM.render( 7 | , 8 | document.getElementById('title') 9 | ); 10 | 11 | ReactDOM.render( 12 | , 13 | document.getElementById('query-detail') 14 | ); 15 | -------------------------------------------------------------------------------- /qinsql-main/etc/catalog/raptor.properties: -------------------------------------------------------------------------------- 1 | # 2 | # WARNING 3 | # ^^^^^^^ 4 | # This configuration file is for development only and should NOT be used be 5 | # used in production. For example configuration, see the Presto documentation. 6 | # 7 | 8 | connector.name=raptor 9 | metadata.db.type=h2 10 | metadata.db.filename=mem:raptor;DB_CLOSE_DELAY=-1 11 | #metadata.db.type=mysql 12 | #metadata.db.connections.max=500 13 | storage.data-directory=file:///tmp/raptor 14 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/6.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Forecasting Revenue Change Query (Q6) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | sum(l_extendedprice * l_discount) as revenue 9 | from 10 | lineitem 11 | where 12 | l_shipdate >= date ':1' 13 | and l_shipdate < date ':1' + interval '1' year 14 | and l_discount between :2 - 0.01 and :2 + 0.01 15 | and l_quantity < :3; 16 | :n -1 17 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/stage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {StageDetail} from "./components/StageDetail"; 4 | import {PageTitle} from "./components/PageTitle"; 5 | 6 | ReactDOM.render( 7 | , 8 | document.getElementById('title') 9 | ); 10 | 11 | ReactDOM.render( 12 | , 13 | document.getElementById('stage-performance-header') 14 | ); 15 | -------------------------------------------------------------------------------- /qinsql-plugin-toolkit/src/test/resources/session_property.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionProperties": [ 3 | { 4 | "user": "admin", 5 | "property": ".*", 6 | "allow": true 7 | }, 8 | { 9 | "user": "alice", 10 | "property": "dangerous", 11 | "allow": false 12 | }, 13 | { 14 | "user": "alice", 15 | "allow": true 16 | }, 17 | { 18 | "user": "bob", 19 | "property": "safe", 20 | "allow": true 21 | } 22 | ] 23 | } -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf3000.0/region.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 5.0, 3 | "columns" : { 4 | "r_regionkey" : { 5 | "distinctValuesCount" : 5.0, 6 | "min" : 0, 7 | "max" : 4 8 | }, 9 | "r_comment" : { 10 | "dataSize" : 330.0, 11 | "distinctValuesCount" : 6.0 12 | }, 13 | "r_name" : { 14 | "dataSize" : 34.0, 15 | "distinctValuesCount" : 7.0 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/17.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Small-Quantity-Order Revenue Query (Q17) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | sum(l_extendedprice) / 7.0 as avg_yearly 9 | from 10 | lineitem, 11 | part 12 | where 13 | p_partkey = l_partkey 14 | and p_brand = ':1' 15 | and p_container = ':2' 16 | and l_quantity < ( 17 | select 18 | 0.2 * avg(l_quantity) 19 | from 20 | lineitem 21 | where 22 | l_partkey = p_partkey 23 | ); 24 | :n -1 25 | -------------------------------------------------------------------------------- /qinsql-plugin-toolkit/src/test/resources/table.json: -------------------------------------------------------------------------------- 1 | { 2 | "tables": [ 3 | { 4 | "schema": "secret", 5 | "privileges": [] 6 | }, 7 | { 8 | "user": "admin", 9 | "schema": ".*", 10 | "privileges": ["SELECT", "INSERT", "DELETE", "OWNERSHIP"] 11 | }, 12 | { 13 | "user": "bob", 14 | "schema": "bobschema", 15 | "table": "bobtable", 16 | "privileges": ["SELECT", "INSERT", "DELETE", "GRANT_SELECT"] 17 | }, 18 | { 19 | "privileges": ["SELECT"] 20 | } 21 | ] 22 | } -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/14.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Promotion Effect Query (Q14) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | 100.00 * sum(case 9 | when p_type like 'PROMO%' 10 | then l_extendedprice * (1 - l_discount) 11 | else 0 12 | end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue 13 | from 14 | lineitem, 15 | part 16 | where 17 | l_partkey = p_partkey 18 | and l_shipdate >= date ':1' 19 | and l_shipdate < date ':1' + interval '1' month; 20 | :n -1 21 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/plan.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {LivePlan} from "./components/LivePlan"; 4 | import {PageTitle} from "./components/PageTitle"; 5 | import {getFirstParameter} from "./utils"; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('title') 10 | ); 11 | 12 | ReactDOM.render( 13 | , 14 | document.getElementById('live-plan-container') 15 | ); 16 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/queue_config_bad_out_degree.json: -------------------------------------------------------------------------------- 1 | { 2 | "queues": { 3 | "q0": { 4 | "maxConcurrent": 5, 5 | "maxQueued": 20 6 | }, 7 | "q1": { 8 | "maxConcurrent": 5, 9 | "maxQueued": 20 10 | }, 11 | "q2": { 12 | "maxConcurrent": 5, 13 | "maxQueued": 20 14 | } 15 | }, 16 | "rules": [ 17 | { 18 | "user": "bob", 19 | "queues": [ 20 | "q0", 21 | "q1" 22 | ] 23 | }, 24 | { 25 | "queues": [ 26 | "q0", 27 | "q2" 28 | ] 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/index.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {ClusterHUD} from "./components/ClusterHUD"; 4 | import {QueryList} from "./components/QueryList"; 5 | import {PageTitle} from "./components/PageTitle"; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('title') 10 | ); 11 | 12 | ReactDOM.render( 13 | , 14 | document.getElementById('cluster-hud') 15 | ); 16 | 17 | ReactDOM.render( 18 | , 19 | document.getElementById('query-list') 20 | ); 21 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/13.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Customer Distribution Query (Q13) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | c_count, 9 | count(*) as custdist 10 | from 11 | ( 12 | select 13 | c_custkey, 14 | count(o_orderkey) 15 | from 16 | customer left outer join orders on 17 | c_custkey = o_custkey 18 | and o_comment not like '%:1%:2%' 19 | group by 20 | c_custkey 21 | ) as c_orders (c_custkey, c_count) 22 | group by 23 | c_count 24 | order by 25 | custdist desc, 26 | c_count desc; 27 | :n -1 28 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/4.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Order Priority Checking Query (Q4) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | o_orderpriority, 9 | count(*) as order_count 10 | from 11 | orders 12 | where 13 | o_orderdate >= date ':1' 14 | and o_orderdate < date ':1' + interval '3' month 15 | and exists ( 16 | select 17 | * 18 | from 19 | lineitem 20 | where 21 | l_orderkey = o_orderkey 22 | and l_commitdate < l_receiptdate 23 | ) 24 | group by 25 | o_orderpriority 26 | order by 27 | o_orderpriority; 28 | :n -1 29 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/worker.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import {WorkerStatus} from "./components/WorkerStatus"; 4 | import {WorkerThreadList} from "./components/WorkerThreadList"; 5 | import {PageTitle} from "./components/PageTitle"; 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('title') 10 | ); 11 | 12 | ReactDOM.render( 13 | , 14 | document.getElementById('worker-status') 15 | ); 16 | 17 | ReactDOM.render( 18 | , 19 | document.getElementById('worker-threads') 20 | ); 21 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/3.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Shipping Priority Query (Q3) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | l_orderkey, 9 | sum(l_extendedprice * (1 - l_discount)) as revenue, 10 | o_orderdate, 11 | o_shippriority 12 | from 13 | customer, 14 | orders, 15 | lineitem 16 | where 17 | c_mktsegment = ':1' 18 | and c_custkey = o_custkey 19 | and l_orderkey = o_orderkey 20 | and o_orderdate < date ':2' 21 | and l_shipdate > date ':2' 22 | group by 23 | l_orderkey, 24 | o_orderdate, 25 | o_shippriority 26 | order by 27 | revenue desc, 28 | o_orderdate; 29 | :n 10 30 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf3000.0/nation.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 25.0, 3 | "columns" : { 4 | "n_regionkey" : { 5 | "distinctValuesCount" : 5.0, 6 | "min" : 0, 7 | "max" : 4 8 | }, 9 | "n_nationkey" : { 10 | "distinctValuesCount" : 19.0, 11 | "min" : 0, 12 | "max" : 24 13 | }, 14 | "n_name" : { 15 | "dataSize" : 177.0, 16 | "distinctValuesCount" : 24.0 17 | }, 18 | "n_comment" : { 19 | "dataSize" : 1857.0, 20 | "distinctValuesCount" : 31.0 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/file-based-system-access-schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "user": "alice", 5 | "catalog": "alice-catalog", 6 | "allow": "read-only" 7 | }, 8 | { 9 | "allow": true 10 | } 11 | ], 12 | "schemas": [ 13 | { 14 | "schema": "secret", 15 | "owner": false 16 | }, 17 | { 18 | "user": "admin", 19 | "schema": ".*", 20 | "owner": true 21 | }, 22 | { 23 | "user": "bob", 24 | "schema": "bob|some-schema", 25 | "owner": true 26 | }, 27 | { 28 | "user": "alice", 29 | "schema": "alice", 30 | "owner": true 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf0.01/region.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 5, 3 | "columns" : { 4 | "r_regionkey" : { 5 | "distinctValuesCount" : 5, 6 | "min" : 0, 7 | "max" : 4, 8 | "dataSize" : null 9 | }, 10 | "r_name" : { 11 | "distinctValuesCount" : 5, 12 | "min" : "AFRICA", 13 | "max" : "MIDDLE EAST", 14 | "dataSize" : 34 15 | }, 16 | "r_comment" : { 17 | "distinctValuesCount" : 5, 18 | "min" : "ges. thinly even pinto beans ca", 19 | "max" : "uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl", 20 | "dataSize" : 330 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf1.0/region.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 5, 3 | "columns" : { 4 | "r_regionkey" : { 5 | "distinctValuesCount" : 5, 6 | "min" : 0, 7 | "max" : 4, 8 | "dataSize" : null 9 | }, 10 | "r_name" : { 11 | "distinctValuesCount" : 5, 12 | "min" : "AFRICA", 13 | "max" : "MIDDLE EAST", 14 | "dataSize" : 34 15 | }, 16 | "r_comment" : { 17 | "distinctValuesCount" : 5, 18 | "min" : "ges. thinly even pinto beans ca", 19 | "max" : "uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl", 20 | "dataSize" : 330 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/catalog_principal.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "allow": true 5 | } 6 | ], 7 | "principals": [ 8 | { 9 | "principal": "(.*)", 10 | "principal_to_user": "$1", 11 | "allow": true 12 | }, 13 | { 14 | "principal": "([^/]+)/?.*@.*", 15 | "principal_to_user": "$1", 16 | "allow": true 17 | }, 18 | { 19 | "principal": "invalid/?.*@.*", 20 | "user": ".*", 21 | "allow": false 22 | }, 23 | { 24 | "principal": "special/?(.*)@.*", 25 | "principal_to_user": "$1", 26 | "allow": true 27 | }, 28 | { 29 | "principal": "valid/?.*@.*", 30 | "user": ".*", 31 | "allow": true 32 | } 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/5.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Local Supplier Volume Query (Q5) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | n_name, 9 | sum(l_extendedprice * (1 - l_discount)) as revenue 10 | from 11 | customer, 12 | orders, 13 | lineitem, 14 | supplier, 15 | nation, 16 | region 17 | where 18 | c_custkey = o_custkey 19 | and l_orderkey = o_orderkey 20 | and l_suppkey = s_suppkey 21 | and c_nationkey = s_nationkey 22 | and s_nationkey = n_nationkey 23 | and n_regionkey = r_regionkey 24 | and r_name = ':1' 25 | and o_orderdate >= date ':2' 26 | and o_orderdate < date ':2' + interval '1' year 27 | group by 28 | n_name 29 | order by 30 | revenue desc; 31 | :n -1 32 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/18.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Large Volume Customer Query (Q18) 3 | -- Function Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | c_name, 9 | c_custkey, 10 | o_orderkey, 11 | o_orderdate, 12 | o_totalprice, 13 | sum(l_quantity) 14 | from 15 | customer, 16 | orders, 17 | lineitem 18 | where 19 | o_orderkey in ( 20 | select 21 | l_orderkey 22 | from 23 | lineitem 24 | group by 25 | l_orderkey having 26 | sum(l_quantity) > :1 27 | ) 28 | and c_custkey = o_custkey 29 | and o_orderkey = l_orderkey 30 | group by 31 | c_name, 32 | c_custkey, 33 | o_orderkey, 34 | o_orderdate, 35 | o_totalprice 36 | order by 37 | o_totalprice desc, 38 | o_orderdate; 39 | :n 100 40 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorIndexHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | public interface ConnectorIndexHandle 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorTableHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | public interface ConnectorTableHandle 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/16.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Parts/Supplier Relationship Query (Q16) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | p_brand, 9 | p_type, 10 | p_size, 11 | count(distinct ps_suppkey) as supplier_cnt 12 | from 13 | partsupp, 14 | part 15 | where 16 | p_partkey = ps_partkey 17 | and p_brand <> ':1' 18 | and p_type not like ':2%' 19 | and p_size in (:3, :4, :5, :6, :7, :8, :9, :10) 20 | and ps_suppkey not in ( 21 | select 22 | s_suppkey 23 | from 24 | supplier 25 | where 26 | s_comment like '%Customer%Complaints%' 27 | ) 28 | group by 29 | p_brand, 30 | p_type, 31 | p_size 32 | order by 33 | supplier_cnt desc, 34 | p_brand, 35 | p_type, 36 | p_size; 37 | :n -1 38 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/storage/TempStorageHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.storage; 15 | 16 | public interface TempStorageHandle 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-matching/src/test/java/com/facebook/presto/matching/example/rel/Expression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.matching.example.rel; 15 | 16 | public class Expression 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/gen/lambda/LambdaFunctionInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.gen.lambda; 15 | 16 | public interface LambdaFunctionInterface {} 17 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/11.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Important Stock Identification Query (Q11) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | ps_partkey, 9 | sum(ps_supplycost * ps_availqty) as value 10 | from 11 | partsupp, 12 | supplier, 13 | nation 14 | where 15 | ps_suppkey = s_suppkey 16 | and s_nationkey = n_nationkey 17 | and n_name = ':1' 18 | group by 19 | ps_partkey having 20 | sum(ps_supplycost * ps_availqty) > ( 21 | select 22 | sum(ps_supplycost * ps_availqty) * :2 23 | from 24 | partsupp, 25 | supplier, 26 | nation 27 | where 28 | ps_suppkey = s_suppkey 29 | and s_nationkey = n_nationkey 30 | and n_name = ':1' 31 | ) 32 | order by 33 | value desc; 34 | :n -1 35 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/security/PrincipalType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.security; 15 | 16 | public enum PrincipalType 17 | { 18 | USER, ROLE 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/ShutdownAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | public interface ShutdownAction 17 | { 18 | void onShutdown(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/analyzer/RegexLibrary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.analyzer; 15 | 16 | public enum RegexLibrary 17 | { 18 | JONI, 19 | RE2J 20 | } 21 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/catalog.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "user": "admin", 5 | "catalog": ".*", 6 | "allow": true 7 | }, 8 | { 9 | "catalog": "secret", 10 | "allow": false 11 | }, 12 | { 13 | "user": ".*", 14 | "catalog": "open-to-all", 15 | "allow": true 16 | }, 17 | { 18 | "catalog": "all-allowed", 19 | "allow": true 20 | }, 21 | { 22 | "user": "alice", 23 | "catalog": "alice-catalog", 24 | "allow": true 25 | }, 26 | { 27 | "user": "bob", 28 | "catalog": "alice-catalog", 29 | "allow": false 30 | }, 31 | { 32 | "user": "\u0194\u0194\u0194", 33 | "catalog": "\u0200\u0200\u0200", 34 | "allow": true 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/1.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Pricing Summary Report Query (Q1) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | l_returnflag, 9 | l_linestatus, 10 | sum(l_quantity) as sum_qty, 11 | sum(l_extendedprice) as sum_base_price, 12 | sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, 13 | sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, 14 | avg(l_quantity) as avg_qty, 15 | avg(l_extendedprice) as avg_price, 16 | avg(l_discount) as avg_disc, 17 | count(*) as count_order 18 | from 19 | lineitem 20 | where 21 | l_shipdate <= date '1998-12-01' - interval ':1' day (3) 22 | group by 23 | l_returnflag, 24 | l_linestatus 25 | order by 26 | l_returnflag, 27 | l_linestatus; 28 | :n -1 29 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ErrorCodeSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | public interface ErrorCodeSupplier 17 | { 18 | ErrorCode toErrorCode(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorTransactionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.connector; 15 | 16 | public interface ConnectorTransactionHandle 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/security/Privilege.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.security; 15 | 16 | public enum Privilege 17 | { 18 | SELECT, DELETE, INSERT, UPDATE 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/statistics/TableStatisticType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.statistics; 15 | 16 | public enum TableStatisticType 17 | { 18 | ROW_COUNT, 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/WarningCodeSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | public interface WarningCodeSupplier 17 | { 18 | WarningCode toWarningCode(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/storage/StorageCapabilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.storage; 15 | 16 | public enum StorageCapabilities 17 | { 18 | REMOTELY_ACCESSIBLE, 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/LocalPlannerAware.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | public interface LocalPlannerAware 17 | { 18 | void localPlannerComplete(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/AccumulatorState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface AccumulatorState 17 | { 18 | long getEstimatedSize(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/10.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Returned Item Reporting Query (Q10) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | c_custkey, 9 | c_name, 10 | sum(l_extendedprice * (1 - l_discount)) as revenue, 11 | c_acctbal, 12 | n_name, 13 | c_address, 14 | c_phone, 15 | c_comment 16 | from 17 | customer, 18 | orders, 19 | lineitem, 20 | nation 21 | where 22 | c_custkey = o_custkey 23 | and l_orderkey = o_orderkey 24 | and o_orderdate >= date ':1' 25 | and o_orderdate < date ':1' + interval '3' month 26 | and l_returnflag = 'R' 27 | and c_nationkey = n_nationkey 28 | group by 29 | c_custkey, 30 | c_name, 31 | c_acctbal, 32 | c_phone, 33 | n_name, 34 | c_address, 35 | c_comment 36 | order by 37 | revenue desc; 38 | :n 20 39 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | public interface ConnectorIndex 17 | { 18 | ConnectorPageSource lookup(RecordSet recordSet); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/FunctionKind.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public enum FunctionKind 17 | { 18 | SCALAR, 19 | AGGREGATE, 20 | WINDOW 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/FunctionNamespaceTransactionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface FunctionNamespaceTransactionHandle 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/NodeResourceStatusProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | public interface NodeResourceStatusProvider 17 | { 18 | boolean hasResources(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/15.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Top Supplier Query (Q15) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | create view revenue:s (supplier_no, total_revenue) as 7 | select 8 | l_suppkey, 9 | sum(l_extendedprice * (1 - l_discount)) 10 | from 11 | lineitem 12 | where 13 | l_shipdate >= date ':1' 14 | and l_shipdate < date ':1' + interval '3' month 15 | group by 16 | l_suppkey; 17 | 18 | :o 19 | select 20 | s_suppkey, 21 | s_name, 22 | s_address, 23 | s_phone, 24 | total_revenue 25 | from 26 | supplier, 27 | revenue:s 28 | where 29 | s_suppkey = supplier_no 30 | and total_revenue = ( 31 | select 32 | max(total_revenue) 33 | from 34 | revenue:s 35 | ) 36 | order by 37 | s_suppkey; 38 | 39 | drop view revenue:s; 40 | :n -1 41 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorInsertTableHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | @SuppressWarnings("MarkerInterface") 17 | public interface ConnectorInsertTableHandle 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorOutputTableHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | @SuppressWarnings("MarkerInterface") 17 | public interface ConnectorOutputTableHandle 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/block/LazyBlockLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.block; 15 | 16 | public interface LazyBlockLoader 17 | { 18 | void load(T block); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/statusservice/NodeStatusService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.statusservice; 15 | 16 | public interface NodeStatusService 17 | { 18 | boolean isAllowed(String host); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-client/src/main/java/com/facebook/presto/client/QueryData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.client; 15 | 16 | import java.util.List; 17 | 18 | public interface QueryData 19 | { 20 | Iterable> getData(); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/planner/planPrinter/Renderer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.planner.planPrinter; 15 | 16 | public interface Renderer 17 | { 18 | T render(PlanRepresentation plan); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/PipelineExecutionStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | public enum PipelineExecutionStrategy 17 | { 18 | UNGROUPED_EXECUTION, 19 | GROUPED_EXECUTION, 20 | } 21 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/catalog_read_only.json: -------------------------------------------------------------------------------- 1 | { 2 | "catalogs": [ 3 | { 4 | "user": "admin", 5 | "catalog": ".*", 6 | "allow": "read-only" 7 | }, 8 | { 9 | "catalog": "secret", 10 | "allow": "none" 11 | }, 12 | { 13 | "user": ".*", 14 | "catalog": "open-to-all", 15 | "allow": "read-only" 16 | }, 17 | { 18 | "catalog": "all-allowed", 19 | "allow": "read-only" 20 | }, 21 | { 22 | "user": "alice", 23 | "catalog": "alice-catalog", 24 | "allow": "read-only" 25 | }, 26 | { 27 | "user": "bob", 28 | "catalog": "alice-catalog", 29 | "allow": "none" 30 | }, 31 | { 32 | "user": "\u0194\u0194\u0194", 33 | "catalog": "\u0200\u0200\u0200", 34 | "allow": "read-only" 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.resourceGroups; 15 | 16 | public enum ResourceGroupState 17 | { 18 | CAN_RUN, 19 | CAN_QUEUE, 20 | FULL 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/warnings/WarningHandlingLevel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.warnings; 15 | 16 | public enum WarningHandlingLevel 17 | { 18 | SUPPRESS, 19 | NORMAL, 20 | AS_ERROR 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/relation/DeterminismEvaluator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.relation; 15 | 16 | public interface DeterminismEvaluator 17 | { 18 | boolean isDeterministic(RowExpression expression); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/type/TestDate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.type; 15 | 16 | public class TestDate 17 | extends TestDateBase 18 | { 19 | public TestDate() 20 | { 21 | super(false); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/type/TestTime.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.type; 15 | 16 | public class TestTime 17 | extends TestTimeBase 18 | { 19 | public TestTime() 20 | { 21 | super(false); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-matching/src/test/java/com/facebook/presto/matching/example/rel/RelNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.matching.example.rel; 15 | 16 | import java.util.List; 17 | 18 | public interface RelNode 19 | { 20 | List getSources(); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramGroupImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.histogram; 15 | 16 | public enum HistogramGroupImplementation 17 | { 18 | LEGACY, NEW 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/FunctionHandleResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface FunctionHandleResolver 17 | { 18 | Class getFunctionHandleClass(); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/schedule/NodeSelectionStrategy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.schedule; 15 | 16 | public enum NodeSelectionStrategy 17 | { 18 | HARD_AFFINITY, 19 | SOFT_AFFINITY, 20 | NO_PREFERENCE 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/cost/CostProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.cost; 15 | 16 | import com.facebook.presto.spi.plan.PlanNode; 17 | 18 | public interface CostProvider 19 | { 20 | PlanCostEstimate getCost(PlanNode node); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/PagesIndexComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | public interface PagesIndexComparator 17 | { 18 | int compareTo(PagesIndex pagesIndex, int leftPosition, int rightPosition); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/ArrayAggGroupImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.arrayagg; 15 | 16 | public enum ArrayAggGroupImplementation 17 | { 18 | LEGACY, 19 | NEW, 20 | } 21 | -------------------------------------------------------------------------------- /qinsql-bytecode/src/main/java/com/facebook/presto/bytecode/debug/DebugNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.bytecode.debug; 15 | 16 | import com.facebook.presto.bytecode.BytecodeNode; 17 | 18 | public interface DebugNode 19 | extends BytecodeNode 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/resourceGroups/SchedulingPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.resourceGroups; 15 | 16 | public enum SchedulingPolicy 17 | { 18 | FAIR, 19 | WEIGHTED, 20 | WEIGHTED_FAIR, 21 | QUERY_PRIORITY 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/cost/StatsProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.cost; 15 | 16 | import com.facebook.presto.spi.plan.PlanNode; 17 | 18 | public interface StatsProvider 19 | { 20 | PlanNodeStatsEstimate getStats(PlanNode node); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/multimapagg/MultimapAggGroupImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.multimapagg; 15 | 16 | public enum MultimapAggGroupImplementation 17 | { 18 | LEGACY, 19 | NEW, 20 | } 21 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/type/TestDateLegacy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.type; 15 | 16 | public class TestDateLegacy 17 | extends TestDateBase 18 | { 19 | public TestDateLegacy() 20 | { 21 | super(true); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/type/TestTimeLegacy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.type; 15 | 16 | public class TestTimeLegacy 17 | extends TestTimeBase 18 | { 19 | public TestTimeLegacy() 20 | { 21 | super(true); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/FunctionMetadataManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface FunctionMetadataManager 17 | { 18 | FunctionMetadata getFunctionMetadata(FunctionHandle functionHandle); 19 | } 20 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf0.01/nation.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 25, 3 | "columns" : { 4 | "n_nationkey" : { 5 | "distinctValuesCount" : 25, 6 | "min" : 0, 7 | "max" : 24, 8 | "dataSize" : null 9 | }, 10 | "n_name" : { 11 | "distinctValuesCount" : 25, 12 | "min" : "ALGERIA", 13 | "max" : "VIETNAM", 14 | "dataSize" : 177 15 | }, 16 | "n_regionkey" : { 17 | "distinctValuesCount" : 5, 18 | "min" : 0, 19 | "max" : 4, 20 | "dataSize" : null 21 | }, 22 | "n_comment" : { 23 | "distinctValuesCount" : 25, 24 | "min" : " haggle. carefully final deposits detect slyly agai", 25 | "max" : "y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be", 26 | "dataSize" : 1857 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf1.0/nation.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 25, 3 | "columns" : { 4 | "n_nationkey" : { 5 | "distinctValuesCount" : 25, 6 | "min" : 0, 7 | "max" : 24, 8 | "dataSize" : null 9 | }, 10 | "n_name" : { 11 | "distinctValuesCount" : 25, 12 | "min" : "ALGERIA", 13 | "max" : "VIETNAM", 14 | "dataSize" : 177 15 | }, 16 | "n_regionkey" : { 17 | "distinctValuesCount" : 5, 18 | "min" : 0, 19 | "max" : 4, 20 | "dataSize" : null 21 | }, 22 | "n_comment" : { 23 | "distinctValuesCount" : 25, 24 | "min" : " haggle. carefully final deposits detect slyly agai", 25 | "max" : "y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be", 26 | "dataSize" : 1857 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/12.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Shipping Modes and Order Priority Query (Q12) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | l_shipmode, 9 | sum(case 10 | when o_orderpriority = '1-URGENT' 11 | or o_orderpriority = '2-HIGH' 12 | then 1 13 | else 0 14 | end) as high_line_count, 15 | sum(case 16 | when o_orderpriority <> '1-URGENT' 17 | and o_orderpriority <> '2-HIGH' 18 | then 1 19 | else 0 20 | end) as low_line_count 21 | from 22 | orders, 23 | lineitem 24 | where 25 | o_orderkey = l_orderkey 26 | and l_shipmode in (':1', ':2') 27 | and l_commitdate < l_receiptdate 28 | and l_shipdate < l_commitdate 29 | and l_receiptdate >= date ':3' 30 | and l_receiptdate < date ':3' + interval '1' year 31 | group by 32 | l_shipmode 33 | order by 34 | l_shipmode; 35 | :n -1 36 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/ScalarFunctionImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | import com.facebook.presto.spi.api.Experimental; 17 | 18 | @Experimental 19 | public interface ScalarFunctionImplementation 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/QueryPerformanceFetcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution; 15 | 16 | import com.facebook.presto.spi.QueryId; 17 | 18 | public interface QueryPerformanceFetcher 19 | { 20 | QueryInfo getQueryInfo(QueryId queryId); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-bytecode/src/main/java/com/facebook/presto/bytecode/instruction/InstructionNode.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.bytecode.instruction; 15 | 16 | import com.facebook.presto.bytecode.BytecodeNode; 17 | 18 | public interface InstructionNode 19 | extends BytecodeNode 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/security/TokenAuthenticator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.security; 15 | 16 | import io.airlift.slice.Slice; 17 | 18 | public interface TokenAuthenticator 19 | { 20 | Slice getAuthenticationToken(Slice authenticationTokenRequest); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/approxmostfrequent/BucketConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.approxmostfrequent; 15 | 16 | @FunctionalInterface 17 | public interface BucketConsumer 18 | { 19 | void process(K key, long value); 20 | } 21 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/gen/lambda/UnaryFunctionInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.gen.lambda; 15 | 16 | @FunctionalInterface 17 | public interface UnaryFunctionInterface 18 | extends LambdaFunctionInterface 19 | { 20 | Object apply(Object arg1); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/util/JsonCastException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.util; 15 | 16 | public class JsonCastException 17 | extends RuntimeException 18 | { 19 | public JsonCastException(String message) 20 | { 21 | super(message); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/sql/planner/assertions/PlanTestSymbol.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.planner.assertions; 15 | 16 | import com.facebook.presto.sql.planner.Symbol; 17 | 18 | public interface PlanTestSymbol 19 | { 20 | Symbol toSymbol(SymbolAliases aliases); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorCapabilities.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.connector; 15 | 16 | public enum ConnectorCapabilities 17 | { 18 | NOT_NULL_COLUMN_CONSTRAINT, 19 | SUPPORTS_REWINDABLE_SPLIT_SOURCE, 20 | SUPPORTS_PAGE_SINK_COMMIT, 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-bytecode/src/main/java/com/facebook/presto/bytecode/control/FlowControl.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.bytecode.control; 15 | 16 | import com.facebook.presto.bytecode.BytecodeNode; 17 | 18 | public interface FlowControl 19 | extends BytecodeNode 20 | { 21 | String getComment(); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/test/resources/queue_config_bad_cycle.json: -------------------------------------------------------------------------------- 1 | { 2 | "queues": { 3 | "q0": { 4 | "maxConcurrent": 5, 5 | "maxQueued": 20 6 | }, 7 | "q1": { 8 | "maxConcurrent": 5, 9 | "maxQueued": 20 10 | }, 11 | "q2": { 12 | "maxConcurrent": 5, 13 | "maxQueued": 20 14 | }, 15 | "q3": { 16 | "maxConcurrent": 5, 17 | "maxQueued": 20 18 | }, 19 | "q4": { 20 | "maxConcurrent": 5, 21 | "maxQueued": 20 22 | }, 23 | "q5": { 24 | "maxConcurrent": 5, 25 | "maxQueued": 20 26 | } 27 | }, 28 | "rules": [ 29 | { 30 | "user": "bob", 31 | "queues": [ 32 | "q0", 33 | "q1", 34 | "q2", 35 | "q3", 36 | "q4" 37 | ] 38 | }, 39 | { 40 | "queues": [ 41 | "q4", 42 | "q5", 43 | "q2" 44 | ] 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/20.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Potential Part Promotion Query (Q20) 3 | -- Function Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | s_name, 9 | s_address 10 | from 11 | supplier, 12 | nation 13 | where 14 | s_suppkey in ( 15 | select 16 | ps_suppkey 17 | from 18 | partsupp 19 | where 20 | ps_partkey in ( 21 | select 22 | p_partkey 23 | from 24 | part 25 | where 26 | p_name like ':1%' 27 | ) 28 | and ps_availqty > ( 29 | select 30 | 0.5 * sum(l_quantity) 31 | from 32 | lineitem 33 | where 34 | l_partkey = ps_partkey 35 | and l_suppkey = ps_suppkey 36 | and l_shipdate >= date ':2' 37 | and l_shipdate < date ':2' + interval '1' year 38 | ) 39 | ) 40 | and s_nationkey = n_nationkey 41 | and n_name = ':3' 42 | order by 43 | s_name; 44 | :n -1 45 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/VariableWidthType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.type; 15 | 16 | /** 17 | * VariableWidthType is a type that can have a different size for every value. 18 | */ 19 | public interface VariableWidthType 20 | extends Type 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/state/RegressionState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.state; 15 | 16 | public interface RegressionState 17 | extends CovarianceState 18 | { 19 | double getM2X(); 20 | 21 | void setM2X(double value); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/SimpleHttpResponseCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | public interface SimpleHttpResponseCallback 17 | { 18 | void success(T value); 19 | 20 | void failed(Throwable cause); 21 | 22 | void fatal(Throwable cause); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/RecordSet.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | import com.facebook.presto.common.type.Type; 17 | 18 | import java.util.List; 19 | 20 | public interface RecordSet 21 | { 22 | List getColumnTypes(); 23 | 24 | RecordCursor cursor(); 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/predicate/AllOrNone.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.predicate; 15 | 16 | public interface AllOrNone 17 | { 18 | /** 19 | * @return true if all values are permitted, false if no values are permitted 20 | */ 21 | boolean isAll(); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/PartitionFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | public interface PartitionFunction 19 | { 20 | int getPartitionCount(); 21 | 22 | int getPartition(Page page, int position); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/DefaultShutdownAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | public class DefaultShutdownAction 17 | implements ShutdownAction 18 | { 19 | @Override 20 | public void onShutdown() 21 | { 22 | System.exit(0); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/gen/lambda/BinaryFunctionInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.gen.lambda; 15 | 16 | @FunctionalInterface 17 | public interface BinaryFunctionInterface 18 | extends LambdaFunctionInterface 19 | { 20 | Object apply(Object arg1, Object arg2); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/9.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Product Type Profit Measure Query (Q9) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | nation, 9 | o_year, 10 | sum(amount) as sum_profit 11 | from 12 | ( 13 | select 14 | n_name as nation, 15 | extract(year from o_orderdate) as o_year, 16 | l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount 17 | from 18 | part, 19 | supplier, 20 | lineitem, 21 | partsupp, 22 | orders, 23 | nation 24 | where 25 | s_suppkey = l_suppkey 26 | and ps_suppkey = l_suppkey 27 | and ps_partkey = l_partkey 28 | and p_partkey = l_partkey 29 | and o_orderkey = l_orderkey 30 | and s_nationkey = n_nationkey 31 | and p_name like '%:1%' 32 | ) as profit 33 | group by 34 | nation, 35 | o_year 36 | order by 37 | nation, 38 | o_year desc; 39 | :n -1 40 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/GroupedAccumulatorState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface GroupedAccumulatorState 17 | extends AccumulatorState 18 | { 19 | void setGroupId(long groupId); 20 | 21 | void ensureCapacity(long size); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/java/com/facebook/presto/tpch/TpchTransactionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.tpch; 15 | 16 | import com.facebook.presto.spi.connector.ConnectorTransactionHandle; 17 | 18 | public enum TpchTransactionHandle 19 | implements ConnectorTransactionHandle 20 | { 21 | INSTANCE 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-tpch/src/main/resources/tpch/statistics/sf3000.0/partsupp.json: -------------------------------------------------------------------------------- 1 | { 2 | "rowCount" : 2.4E9, 3 | "columns" : { 4 | "ps_suppkey" : { 5 | "distinctValuesCount" : 4.5300013E7, 6 | "min" : 1, 7 | "max" : 30000000 8 | }, 9 | "ps_partkey" : { 10 | "distinctValuesCount" : 5.35201957E8, 11 | "min" : 1, 12 | "max" : 600000000 13 | }, 14 | "ps_comment" : { 15 | "dataSize" : 2.96396748667E11, 16 | "distinctValuesCount" : 2.79448686E8 17 | }, 18 | "ps_availqty" : { 19 | "distinctValuesCount" : 13152.0, 20 | "min" : 1, 21 | "max" : 9999 22 | }, 23 | "ps_supplycost" : { 24 | "distinctValuesCount" : 100756.0, 25 | "min" : 1.0, 26 | "max" : 1000.0 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-geospatial-toolkit/src/main/java/com/facebook/presto/geospatial/rtree/HasExtent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.geospatial.rtree; 15 | 16 | import com.facebook.presto.geospatial.Rectangle; 17 | 18 | public interface HasExtent 19 | { 20 | Rectangle getExtent(); 21 | long getEstimatedSizeInBytes(); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/dispatcher/CoordinatorLocation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.dispatcher; 15 | 16 | import javax.ws.rs.core.UriInfo; 17 | 18 | import java.net.URI; 19 | 20 | public interface CoordinatorLocation 21 | { 22 | URI getUri(UriInfo uriInfo, String xForwardedProto); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/OuterPositionIterator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.common.PageBuilder; 17 | 18 | public interface OuterPositionIterator 19 | { 20 | boolean appendToNext(PageBuilder pageBuilder, int outputChannelOffset); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/sql/planner/VariableResolver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.planner; 15 | 16 | import com.facebook.presto.spi.relation.VariableReferenceExpression; 17 | 18 | public interface VariableResolver 19 | { 20 | Object getValue(VariableReferenceExpression variable); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/sql/planner/TestingConnectorIndexHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.planner; 15 | 16 | import com.facebook.presto.spi.ConnectorIndexHandle; 17 | 18 | public enum TestingConnectorIndexHandle 19 | implements ConnectorIndexHandle 20 | { 21 | INSTANCE 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/PageIndexerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | import com.facebook.presto.common.type.Type; 17 | 18 | import java.util.List; 19 | 20 | public interface PageIndexerFactory 21 | { 22 | PageIndexer createPageIndexer(List types); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/eventlistener/EventListenerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.eventlistener; 15 | 16 | import java.util.Map; 17 | 18 | public interface EventListenerFactory 19 | { 20 | String getName(); 21 | 22 | EventListener create(Map config); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/ExchangeClientSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.memory.context.LocalMemoryContext; 17 | 18 | public interface ExchangeClientSupplier 19 | { 20 | ExchangeClient get(LocalMemoryContext systemMemoryContext); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/PageWithPositionComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | public interface PageWithPositionComparator 19 | { 20 | int compareTo(Page left, int leftPosition, Page right, int rightPosition); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/memory/ClusterMemoryPoolManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.memory; 15 | 16 | import java.util.function.Consumer; 17 | 18 | public interface ClusterMemoryPoolManager 19 | { 20 | void addChangeListener(MemoryPoolId poolId, Consumer listener); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/scheduler/ExecutionPolicy.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.scheduler; 15 | 16 | import java.util.Collection; 17 | 18 | public interface ExecutionPolicy 19 | { 20 | ExecutionSchedule createExecutionSchedule(Collection stages); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/scheduler/ExecutionSchedule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.scheduler; 15 | 16 | import java.util.Set; 17 | 18 | public interface ExecutionSchedule 19 | { 20 | Set getStagesToSchedule(); 21 | 22 | boolean isFinished(); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/resourcemanager/ClusterStatusSender.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.resourcemanager; 15 | 16 | import com.facebook.presto.execution.ManagedQueryExecution; 17 | 18 | public interface ClusterStatusSender 19 | { 20 | void registerQuery(ManagedQueryExecution queryExecution); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/SessionSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | import com.facebook.presto.Session; 17 | import com.facebook.presto.spi.QueryId; 18 | 19 | public interface SessionSupplier 20 | { 21 | Session createSession(QueryId queryId, SessionContext context); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/plan/PlanNodeIdAllocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.plan; 15 | 16 | public class PlanNodeIdAllocator 17 | { 18 | private int nextId; 19 | 20 | public PlanNodeId getNextId() 21 | { 22 | return new PlanNodeId(Integer.toString(nextId++)); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/security/SystemAccessControlFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.security; 15 | 16 | import java.util.Map; 17 | 18 | public interface SystemAccessControlFactory 19 | { 20 | String getName(); 21 | 22 | SystemAccessControl create(Map config); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/storage/TempStorageFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.storage; 15 | 16 | import java.util.Map; 17 | 18 | public interface TempStorageFactory 19 | { 20 | String getName(); 21 | 22 | TempStorage create(Map config, TempStorageContext context); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-bytecode/src/main/java/com/facebook/presto/bytecode/ByteCodeTooLargeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.bytecode; 15 | 16 | public class ByteCodeTooLargeException 17 | extends RuntimeException 18 | { 19 | public ByteCodeTooLargeException(Exception cause) 20 | { 21 | super(cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/InternalJoinFilterFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | public interface InternalJoinFilterFunction 19 | { 20 | boolean filter(int leftPosition, Page leftPage, int rightPosition, Page rightPage); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/ConnectorTableLayoutHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | import java.util.Optional; 17 | 18 | public interface ConnectorTableLayoutHandle 19 | { 20 | default Object getIdentifier(Optional split) 21 | { 22 | return this; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/security/PasswordAuthenticatorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.security; 15 | 16 | import java.util.Map; 17 | 18 | public interface PasswordAuthenticatorFactory 19 | { 20 | String getName(); 21 | 22 | PasswordAuthenticator create(Map config); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-local-file/src/main/java/com/facebook/presto/localfile/LocalFileTransactionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.localfile; 15 | 16 | import com.facebook.presto.spi.connector.ConnectorTransactionHandle; 17 | 18 | public enum LocalFileTransactionHandle 19 | implements ConnectorTransactionHandle 20 | { 21 | INSTANCE 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/warnings/WarningCollectorFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.warnings; 15 | 16 | import com.facebook.presto.spi.WarningCollector; 17 | 18 | public interface WarningCollectorFactory 19 | { 20 | WarningCollector create(WarningHandlingLevel warningHandlingLevel); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/RemoteNodeState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import com.facebook.presto.spi.NodeState; 17 | 18 | import java.util.Optional; 19 | 20 | public interface RemoteNodeState 21 | { 22 | Optional getNodeState(); 23 | 24 | void asyncRefresh(); 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/ParametricImplementation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.spi.function.Signature; 17 | 18 | public interface ParametricImplementation 19 | { 20 | Signature getSignature(); 21 | 22 | boolean hasSpecializedTypeParameters(); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/BlockComparator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | 18 | public interface BlockComparator 19 | { 20 | int compareTo(Block leftBlock, int leftIndex, Block rightBlock, int rightIndex); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/histogram/HistogramValueReader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.histogram; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | 18 | public interface HistogramValueReader 19 | { 20 | void read(Block block, int position, long count); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/prerequisites/QueryPrerequisitesFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.prerequisites; 15 | 16 | import java.util.Map; 17 | 18 | public interface QueryPrerequisitesFactory 19 | { 20 | String getName(); 21 | 22 | QueryPrerequisites create(Map properties); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/arrayagg/ArrayAggregationStateConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.arrayagg; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | 18 | public interface ArrayAggregationStateConsumer 19 | { 20 | void accept(Block block, int position); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-parser/src/main/java/com/facebook/presto/sql/tree/RoutineBody.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.tree; 15 | 16 | import java.util.Optional; 17 | 18 | public abstract class RoutineBody 19 | extends Node 20 | { 21 | public RoutineBody(Optional location) 22 | { 23 | super(location); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-parser/src/main/java/com/facebook/presto/sql/tree/SelectItem.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.tree; 15 | 16 | import java.util.Optional; 17 | 18 | public abstract class SelectItem 19 | extends Node 20 | { 21 | protected SelectItem(Optional location) 22 | { 23 | super(location); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-bytecode/src/main/java/com/facebook/presto/bytecode/CompilationException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.bytecode; 15 | 16 | public class CompilationException 17 | extends RuntimeException 18 | { 19 | public CompilationException(String message, RuntimeException cause) 20 | { 21 | super(message, cause); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/sql/planner/TestingConnectorTransactionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.sql.planner; 15 | 16 | import com.facebook.presto.spi.connector.ConnectorTransactionHandle; 17 | 18 | public enum TestingConnectorTransactionHandle 19 | implements ConnectorTransactionHandle 20 | { 21 | INSTANCE 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/LongAndBlockPositionValueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface LongAndBlockPositionValueState 17 | extends KeyAndBlockPositionValueState 18 | { 19 | long getFirst(); 20 | 21 | void setFirst(long first); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/resourceGroups/SessionPropertyConfigurationManagerContext.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.resourceGroups; 15 | 16 | public interface SessionPropertyConfigurationManagerContext 17 | { 18 | default String getEnvironment() 19 | { 20 | throw new UnsupportedOperationException(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/resourceGroups/Queue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.resourceGroups; 15 | 16 | interface Queue 17 | { 18 | boolean contains(E element); 19 | 20 | boolean remove(E element); 21 | 22 | E poll(); 23 | 24 | E peek(); 25 | 26 | int size(); 27 | 28 | boolean isEmpty(); 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/DoubleAndBlockPositionValueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface DoubleAndBlockPositionValueState 17 | extends KeyAndBlockPositionValueState 18 | { 19 | double getFirst(); 20 | 21 | void setFirst(double first); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/state/LongState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.state; 15 | 16 | import com.facebook.presto.spi.function.AccumulatorState; 17 | 18 | public interface LongState 19 | extends AccumulatorState 20 | { 21 | long getLong(); 22 | 23 | void setLong(long value); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/operator/aggregation/TestBooleanMaxAggregation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation; 15 | 16 | public class TestBooleanMaxAggregation 17 | extends TestBooleanOrAggregation 18 | { 19 | @Override 20 | protected String getFunctionName() 21 | { 22 | return "max"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/operator/aggregation/TestBooleanMinAggregation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation; 15 | 16 | public class TestBooleanMinAggregation 17 | extends TestBooleanAndAggregation 18 | { 19 | @Override 20 | protected String getFunctionName() 21 | { 22 | return "min"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/TDigestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.type; 15 | 16 | import static com.facebook.presto.common.type.StandardTypes.TDIGEST; 17 | 18 | class TDigestType 19 | extends StatisticalDigestType 20 | { 21 | TDigestType(Type type) 22 | { 23 | super(TDIGEST, type); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/BooleanAndBlockPositionValueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface BooleanAndBlockPositionValueState 17 | extends KeyAndBlockPositionValueState 18 | { 19 | boolean getFirst(); 20 | 21 | void setFirst(boolean first); 22 | } 23 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/security/RoleType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server.security; 15 | 16 | public final class RoleType 17 | { 18 | public static final String USER = "user"; 19 | public static final String INTERNAL = "internal"; 20 | public static final String ADMIN = "admin"; 21 | 22 | private RoleType() {} 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/state/DoubleState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.state; 15 | 16 | import com.facebook.presto.spi.function.AccumulatorState; 17 | 18 | public interface DoubleState 19 | extends AccumulatorState 20 | { 21 | double getDouble(); 22 | 23 | void setDouble(double value); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/multimapagg/MultimapAggregationStateConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.multimapagg; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | 18 | public interface MultimapAggregationStateConsumer 19 | { 20 | void accept(Block keyBlock, Block valueBlock, int position); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/scalar/LongToBooleanFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import com.facebook.presto.sql.gen.lambda.LambdaFunctionInterface; 17 | 18 | @FunctionalInterface 19 | public interface LongToBooleanFunction 20 | extends LambdaFunctionInterface 21 | { 22 | Boolean apply(Long value); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/BuiltInFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import com.facebook.presto.spi.function.SqlFunction; 17 | 18 | public abstract class BuiltInFunction 19 | implements SqlFunction 20 | { 21 | @Override 22 | public boolean isCalledOnNullInput() 23 | { 24 | return false; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/JoinFilterFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | import javax.annotation.concurrent.NotThreadSafe; 19 | 20 | @NotThreadSafe 21 | public interface JoinFilterFunction 22 | { 23 | boolean filter(int leftPosition, int rightPosition, Page rightPage); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/state/BooleanDistinctState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.state; 15 | 16 | import com.facebook.presto.spi.function.AccumulatorState; 17 | 18 | public interface BooleanDistinctState 19 | extends AccumulatorState 20 | { 21 | byte getByte(); 22 | 23 | void setByte(byte value); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/state/CorrelationState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.state; 15 | 16 | public interface CorrelationState 17 | extends CovarianceState 18 | { 19 | double getM2X(); 20 | 21 | void setM2X(double value); 22 | 23 | double getM2Y(); 24 | 25 | void setM2Y(double value); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/scalar/DoubleToBooleanFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import com.facebook.presto.sql.gen.lambda.LambdaFunctionInterface; 17 | 18 | @FunctionalInterface 19 | public interface DoubleToBooleanFunction 20 | extends LambdaFunctionInterface 21 | { 22 | Boolean apply(Double value); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorPartitionHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.connector; 15 | 16 | @SuppressWarnings("ClassMayBeInterface") 17 | public abstract class ConnectorPartitionHandle 18 | { 19 | @Override 20 | public abstract boolean equals(Object obj); 21 | 22 | @Override 23 | public abstract int hashCode(); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/SqlFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | public interface SqlFunction 17 | { 18 | Signature getSignature(); 19 | 20 | SqlFunctionVisibility getVisibility(); 21 | 22 | boolean isDeterministic(); 23 | 24 | boolean isCalledOnNullInput(); 25 | 26 | String getDescription(); 27 | } 28 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/EnumType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.type; 15 | 16 | import java.util.Map; 17 | import java.util.Optional; 18 | 19 | public interface EnumType 20 | extends Type 21 | { 22 | Map getEnumMap(); 23 | 24 | Optional getEnumKeyForValue(T value); 25 | 26 | Type getValueType(); 27 | } 28 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/QuantileDigestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.type; 15 | 16 | import static com.facebook.presto.common.type.StandardTypes.QDIGEST; 17 | 18 | class QuantileDigestType 19 | extends StatisticalDigestType 20 | { 21 | QuantileDigestType(Type type) 22 | { 23 | super(QDIGEST, type); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/scalar/BooleanToBooleanFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import com.facebook.presto.sql.gen.lambda.LambdaFunctionInterface; 17 | 18 | @FunctionalInterface 19 | public interface BooleanToBooleanFunction 20 | extends LambdaFunctionInterface 21 | { 22 | Boolean apply(Boolean value); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "presto-webui", 3 | "version": "0.0.1", 4 | "license": "Apache-2.0", 5 | "private": true, 6 | "devDependencies": { 7 | "babel-core": "^6.26.3", 8 | "babel-loader": "^7.1.5", 9 | "babel-preset-env": "^1.7.0", 10 | "babel-preset-flow": "^6.23.0", 11 | "babel-preset-react": "^6.24.1", 12 | "flow-bin": "^0.85.0", 13 | "webpack": "^4.16.0", 14 | "webpack-command": "^0.4.1" 15 | }, 16 | "dependencies": { 17 | "d3": "^5.7.0", 18 | "dagre-d3": "^0.6.1", 19 | "react": "^16.4.1", 20 | "react-dom": "^16.4.1", 21 | "reactable": "^1.0.2" 22 | }, 23 | "babel": { 24 | "presets": [ 25 | "env", 26 | "react", 27 | "flow" 28 | ] 29 | }, 30 | "scripts": { 31 | "install": "webpack --config webpack.config.js", 32 | "package": "webpack -p --config webpack.config.js", 33 | "watch": "webpack --config webpack.config.js --watch" 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/22.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Global Sales Opportunity Query (Q22) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | cntrycode, 9 | count(*) as numcust, 10 | sum(c_acctbal) as totacctbal 11 | from 12 | ( 13 | select 14 | substring(c_phone from 1 for 2) as cntrycode, 15 | c_acctbal 16 | from 17 | customer 18 | where 19 | substring(c_phone from 1 for 2) in 20 | (':1', ':2', ':3', ':4', ':5', ':6', ':7') 21 | and c_acctbal > ( 22 | select 23 | avg(c_acctbal) 24 | from 25 | customer 26 | where 27 | c_acctbal > 0.00 28 | and substring(c_phone from 1 for 2) in 29 | (':1', ':2', ':3', ':4', ':5', ':6', ':7') 30 | ) 31 | and not exists ( 32 | select 33 | * 34 | from 35 | orders 36 | where 37 | o_custkey = c_custkey 38 | ) 39 | ) as custsale 40 | group by 41 | cntrycode 42 | order by 43 | cntrycode; 44 | :n -1 45 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorPartitioningHandle.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.connector; 15 | 16 | public interface ConnectorPartitioningHandle 17 | { 18 | default boolean isSingleNode() 19 | { 20 | return false; 21 | } 22 | 23 | default boolean isCoordinatorOnly() 24 | { 25 | return false; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/statistics/ColumnStatisticType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.statistics; 15 | 16 | public enum ColumnStatisticType 17 | { 18 | MIN_VALUE, 19 | MAX_VALUE, 20 | NUMBER_OF_DISTINCT_VALUES, 21 | NUMBER_OF_NON_NULL_VALUES, 22 | NUMBER_OF_TRUE_VALUES, 23 | MAX_VALUE_SIZE_IN_BYTES, 24 | TOTAL_SIZE_IN_BYTES, 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/LongLongState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface LongLongState 17 | extends TwoNullableValueState 18 | { 19 | long getFirst(); 20 | 21 | void setFirst(long first); 22 | 23 | long getSecond(); 24 | 25 | void setSecond(long second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/server/ServiceUnavailableException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.server; 15 | 16 | import java.net.URI; 17 | 18 | public class ServiceUnavailableException 19 | extends RuntimeException 20 | { 21 | public ServiceUnavailableException(URI uri) 22 | { 23 | super("Server returned SERVICE_UNAVAILABLE: " + uri); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/resources/webapp/src/webpack.config.js: -------------------------------------------------------------------------------- 1 | /* global __dirname */ 2 | 3 | const process = require('process'); 4 | 5 | const mode = process.argv.includes('-p') ? 'production' : 'development'; 6 | 7 | module.exports = { 8 | entry: { 9 | 'index': `${__dirname}/index.jsx`, 10 | 'query': `${__dirname}/query.jsx`, 11 | 'plan': `${__dirname}/plan.jsx`, 12 | 'embedded_plan': `${__dirname}/embedded_plan.jsx`, 13 | 'stage': `${__dirname}/stage.jsx`, 14 | 'worker': `${__dirname}/worker.jsx`, 15 | }, 16 | mode, 17 | module: { 18 | rules: [ 19 | { 20 | test: /\.(js|jsx)$/, 21 | exclude: /node_modules/, 22 | use: ['babel-loader'] 23 | } 24 | ] 25 | }, 26 | resolve: { 27 | extensions: ['*', '.js', '.jsx'] 28 | }, 29 | output: { 30 | path: __dirname + '/../dist', 31 | filename: '[name].js' 32 | } 33 | }; 34 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/BucketFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | public interface BucketFunction 19 | { 20 | /** 21 | * Gets the bucket for the tuple at the specified position. 22 | * Note the tuple values may be null. 23 | */ 24 | int getBucket(Page page, int position); 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/execution/scheduler/OutputBufferManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.execution.scheduler; 15 | 16 | import com.facebook.presto.execution.buffer.OutputBuffers.OutputBufferId; 17 | 18 | import java.util.List; 19 | 20 | interface OutputBufferManager 21 | { 22 | void addOutputBuffers(List newBuffers, boolean noMoreBuffers); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/DoubleLongState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface DoubleLongState 17 | extends TwoNullableValueState 18 | { 19 | double getFirst(); 20 | 21 | void setFirst(double first); 22 | 23 | long getSecond(); 24 | 25 | void setSecond(long second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/LongDoubleState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface LongDoubleState 17 | extends TwoNullableValueState 18 | { 19 | long getFirst(); 20 | 21 | void setFirst(long first); 22 | 23 | double getSecond(); 24 | 25 | void setSecond(double second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-thrift-api/src/main/java/com/facebook/presto/thrift/api/datatypes/PrestoThriftColumnData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.thrift.api.datatypes; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | import com.facebook.presto.common.type.Type; 18 | 19 | public interface PrestoThriftColumnData 20 | { 21 | Block toBlock(Type desiredType); 22 | 23 | int numberOfRecords(); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/BooleanLongState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface BooleanLongState 17 | extends TwoNullableValueState 18 | { 19 | boolean getFirst(); 20 | 21 | void setFirst(boolean first); 22 | 23 | long getSecond(); 24 | 25 | void setSecond(long second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/LongBooleanState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface LongBooleanState 17 | extends TwoNullableValueState 18 | { 19 | long getFirst(); 20 | 21 | void setFirst(long first); 22 | 23 | boolean getSecond(); 24 | 25 | void setSecond(boolean second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/SliceAndBlockPositionValueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | import io.airlift.slice.Slice; 17 | 18 | public interface SliceAndBlockPositionValueState 19 | extends KeyAndBlockPositionValueState 20 | { 21 | Slice getFirst(); 22 | 23 | void setFirst(Slice first); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/21.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Suppliers Who Kept Orders Waiting Query (Q21) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | s_name, 9 | count(*) as numwait 10 | from 11 | supplier, 12 | lineitem l1, 13 | orders, 14 | nation 15 | where 16 | s_suppkey = l1.l_suppkey 17 | and o_orderkey = l1.l_orderkey 18 | and o_orderstatus = 'F' 19 | and l1.l_receiptdate > l1.l_commitdate 20 | and exists ( 21 | select 22 | * 23 | from 24 | lineitem l2 25 | where 26 | l2.l_orderkey = l1.l_orderkey 27 | and l2.l_suppkey <> l1.l_suppkey 28 | ) 29 | and not exists ( 30 | select 31 | * 32 | from 33 | lineitem l3 34 | where 35 | l3.l_orderkey = l1.l_orderkey 36 | and l3.l_suppkey <> l1.l_suppkey 37 | and l3.l_receiptdate > l3.l_commitdate 38 | ) 39 | and s_nationkey = n_nationkey 40 | and n_name = ':1' 41 | group by 42 | s_name 43 | order by 44 | numwait desc, 45 | s_name; 46 | :n 100 47 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/DoubleDoubleState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface DoubleDoubleState 17 | extends TwoNullableValueState 18 | { 19 | double getFirst(); 20 | 21 | void setFirst(double first); 22 | 23 | double getSecond(); 24 | 25 | void setSecond(double second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/operator/scalar/TestJoniRegexpFunctions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import static com.facebook.presto.sql.analyzer.RegexLibrary.JONI; 17 | 18 | public class TestJoniRegexpFunctions 19 | extends AbstractTestRegexpFunctions 20 | { 21 | public TestJoniRegexpFunctions() 22 | { 23 | super(JONI); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/test/java/com/facebook/presto/operator/scalar/TestRe2jRegexpFunctions.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import static com.facebook.presto.sql.analyzer.RegexLibrary.RE2J; 17 | 18 | public class TestRe2jRegexpFunctions 19 | extends AbstractTestRegexpFunctions 20 | { 21 | public TestRe2jRegexpFunctions() 22 | { 23 | super(RE2J); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/approxmostfrequent/ApproximateMostFrequentBucketSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.approxmostfrequent; 15 | 16 | import io.airlift.slice.DynamicSliceOutput; 17 | 18 | public interface ApproximateMostFrequentBucketSerializer 19 | { 20 | public void serialize(K key, long count, DynamicSliceOutput output); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/BooleanDoubleState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface BooleanDoubleState 17 | extends TwoNullableValueState 18 | { 19 | boolean getFirst(); 20 | 21 | void setFirst(boolean first); 22 | 23 | double getSecond(); 24 | 25 | void setSecond(double second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/DoubleBooleanState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface DoubleBooleanState 17 | extends TwoNullableValueState 18 | { 19 | double getFirst(); 20 | 21 | void setFirst(double first); 22 | 23 | boolean getSecond(); 24 | 25 | void setSecond(boolean second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/connector/ConnectorOutputMetadata.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.connector; 15 | 16 | /** 17 | * Connectors can choose to return ConnectorOutputMetadata from finishInsert or finishCreate. 18 | *

19 | * The getInfo method must return a JSON-serializable object 20 | */ 21 | public interface ConnectorOutputMetadata 22 | { 23 | Object getInfo(); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/relation/Predicate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.relation; 15 | 16 | import com.facebook.presto.common.Page; 17 | import com.facebook.presto.common.function.SqlFunctionProperties; 18 | 19 | public interface Predicate 20 | { 21 | int[] getInputChannels(); 22 | 23 | boolean evaluate(SqlFunctionProperties properties, Page page, int position); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/BlockAndBlockPositionValueState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | 18 | public interface BlockAndBlockPositionValueState 19 | extends KeyAndBlockPositionValueState 20 | { 21 | Block getFirst(); 22 | 23 | void setFirst(Block first); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/minmaxby/BooleanBooleanState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.minmaxby; 15 | 16 | public interface BooleanBooleanState 17 | extends TwoNullableValueState 18 | { 19 | boolean getFirst(); 20 | 21 | void setFirst(boolean first); 22 | 23 | boolean getSecond(); 24 | 25 | void setSecond(boolean second); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/scalar/SliceToBooleanFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import com.facebook.presto.sql.gen.lambda.LambdaFunctionInterface; 17 | import io.airlift.slice.Slice; 18 | 19 | @FunctionalInterface 20 | public interface SliceToBooleanFunction 21 | extends LambdaFunctionInterface 22 | { 23 | Boolean apply(Slice value); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/IsNull.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | import java.lang.annotation.ElementType; 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.RetentionPolicy; 19 | import java.lang.annotation.Target; 20 | 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target(ElementType.PARAMETER) 23 | public @interface IsNull 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/predicate/DiscreteValues.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.predicate; 15 | 16 | import java.util.Collection; 17 | 18 | public interface DiscreteValues 19 | { 20 | /** 21 | * @return true if the values are to be included, false if the values are to be excluded 22 | */ 23 | boolean isWhiteList(); 24 | 25 | Collection getValues(); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/TablePropertyManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import static com.facebook.presto.spi.StandardErrorCode.INVALID_TABLE_PROPERTY; 17 | 18 | public class TablePropertyManager 19 | extends AbstractPropertyManager 20 | { 21 | public TablePropertyManager() 22 | { 23 | super("table", INVALID_TABLE_PROPERTY); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/UpdateMemory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | public interface UpdateMemory 17 | { 18 | UpdateMemory NOOP = () -> true; 19 | 20 | /** 21 | * Update memory reservation. 22 | * 23 | * @return false if the caller should yield because requested memory reservation cannot be satisfied 24 | */ 25 | boolean update(); 26 | } 27 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/aggregation/approxmostfrequent/ApproximateMostFrequentBucketDeserializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.aggregation.approxmostfrequent; 15 | 16 | import io.airlift.slice.SliceInput; 17 | 18 | public interface ApproximateMostFrequentBucketDeserializer 19 | { 20 | void deserialize(SliceInput input, ApproximateMostFrequentHistogram histogram); 21 | } 22 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/resourcemanager/MemoryManagerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.resourcemanager; 15 | 16 | import com.facebook.presto.spi.memory.ClusterMemoryPoolInfo; 17 | import com.facebook.presto.spi.memory.MemoryPoolId; 18 | 19 | import java.util.Map; 20 | 21 | public interface MemoryManagerService 22 | { 23 | Map getMemoryPoolInfo(); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/FunctionNamespaceManagerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | import java.util.Map; 17 | 18 | public interface FunctionNamespaceManagerFactory 19 | { 20 | String getName(); 21 | 22 | FunctionHandleResolver getHandleResolver(); 23 | 24 | FunctionNamespaceManager create(String catalogName, Map config); 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/ColumnPropertyManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import static com.facebook.presto.spi.StandardErrorCode.INVALID_COLUMN_PROPERTY; 17 | 18 | public class ColumnPropertyManager 19 | extends AbstractPropertyManager 20 | { 21 | public ColumnPropertyManager() 22 | { 23 | super("column", INVALID_COLUMN_PROPERTY); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/SchemaPropertyManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import static com.facebook.presto.spi.StandardErrorCode.INVALID_SCHEMA_PROPERTY; 17 | 18 | public class SchemaPropertyManager 19 | extends AbstractPropertyManager 20 | { 21 | public SchemaPropertyManager() 22 | { 23 | super("schema", INVALID_SCHEMA_PROPERTY); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-parser/src/test/resources/tpch/queries/2.sql: -------------------------------------------------------------------------------- 1 | -- $ID$ 2 | -- TPC-H/TPC-R Minimum Cost Supplier Query (Q2) 3 | -- Functional Query Definition 4 | -- Approved February 1998 5 | :x 6 | :o 7 | select 8 | s_acctbal, 9 | s_name, 10 | n_name, 11 | p_partkey, 12 | p_mfgr, 13 | s_address, 14 | s_phone, 15 | s_comment 16 | from 17 | part, 18 | supplier, 19 | partsupp, 20 | nation, 21 | region 22 | where 23 | p_partkey = ps_partkey 24 | and s_suppkey = ps_suppkey 25 | and p_size = :1 26 | and p_type like '%:2' 27 | and s_nationkey = n_nationkey 28 | and n_regionkey = r_regionkey 29 | and r_name = ':3' 30 | and ps_supplycost = ( 31 | select 32 | min(ps_supplycost) 33 | from 34 | partsupp, 35 | supplier, 36 | nation, 37 | region 38 | where 39 | p_partkey = ps_partkey 40 | and s_suppkey = ps_suppkey 41 | and s_nationkey = n_nationkey 42 | and n_regionkey = r_regionkey 43 | and r_name = ':3' 44 | ) 45 | order by 46 | s_acctbal desc, 47 | n_name, 48 | s_name, 49 | p_partkey; 50 | :n 100 51 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/BlockIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | import java.lang.annotation.ElementType; 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.RetentionPolicy; 19 | import java.lang.annotation.Target; 20 | 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target(ElementType.PARAMETER) 23 | public @interface BlockIndex 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/metadata/AnalyzePropertyManager.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.metadata; 15 | 16 | import static com.facebook.presto.spi.StandardErrorCode.INVALID_ANALYZE_PROPERTY; 17 | 18 | public class AnalyzePropertyManager 19 | extends AbstractPropertyManager 20 | { 21 | public AnalyzePropertyManager() 22 | { 23 | super("analyze", INVALID_ANALYZE_PROPERTY); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/BlockedReason.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator; 15 | 16 | import com.facebook.drift.annotations.ThriftEnum; 17 | import com.facebook.drift.annotations.ThriftEnumValue; 18 | 19 | @ThriftEnum 20 | public enum BlockedReason 21 | { 22 | WAITING_FOR_MEMORY; 23 | 24 | @ThriftEnumValue 25 | public int getValue() 26 | { 27 | return 1; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/operator/scalar/BlockToBooleanFunction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.operator.scalar; 15 | 16 | import com.facebook.presto.common.block.Block; 17 | import com.facebook.presto.sql.gen.lambda.LambdaFunctionInterface; 18 | 19 | @FunctionalInterface 20 | public interface BlockToBooleanFunction 21 | extends LambdaFunctionInterface 22 | { 23 | Boolean apply(Block value); 24 | } 25 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/PageIndexer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi; 15 | 16 | import com.facebook.presto.common.Page; 17 | 18 | public interface PageIndexer 19 | { 20 | /** 21 | * Returns the unique index of each position value. 22 | */ 23 | int[] indexPage(Page page); 24 | 25 | /** 26 | * Returns maximum index value returned. 27 | */ 28 | int getMaxIndex(); 29 | } 30 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/function/BlockPosition.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.function; 15 | 16 | import java.lang.annotation.ElementType; 17 | import java.lang.annotation.Retention; 18 | import java.lang.annotation.RetentionPolicy; 19 | import java.lang.annotation.Target; 20 | 21 | @Retention(RetentionPolicy.RUNTIME) 22 | @Target(ElementType.PARAMETER) 23 | public @interface BlockPosition 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /qinsql-spi/src/main/java/com/facebook/presto/spi/resourceGroups/ResourceGroupConfigurationManagerFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.spi.resourceGroups; 15 | 16 | import java.util.Map; 17 | 18 | public interface ResourceGroupConfigurationManagerFactory 19 | { 20 | String getName(); 21 | 22 | ResourceGroupConfigurationManager create(Map config, ResourceGroupConfigurationManagerContext context); 23 | } 24 | -------------------------------------------------------------------------------- /qinsql-common/src/main/java/com/facebook/presto/common/type/ParametricType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.common.type; 15 | 16 | import java.util.List; 17 | 18 | public interface ParametricType 19 | { 20 | String getName(); 21 | 22 | default TypeSignatureBase getTypeSignatureBase() 23 | { 24 | return TypeSignatureBase.of(getName()); 25 | } 26 | 27 | Type createType(List parameters); 28 | } 29 | -------------------------------------------------------------------------------- /qinsql-main/src/main/java/com/facebook/presto/memory/VoidTraversingQueryContextVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed under the Apache License, Version 2.0 (the "License"); 3 | * you may not use this file except in compliance with the License. 4 | * You may obtain a copy of the License at 5 | * 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Unless required by applicable law or agreed to in writing, software 9 | * distributed under the License is distributed on an "AS IS" BASIS, 10 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | * See the License for the specific language governing permissions and 12 | * limitations under the License. 13 | */ 14 | package com.facebook.presto.memory; 15 | 16 | import java.util.List; 17 | 18 | public abstract class VoidTraversingQueryContextVisitor 19 | extends TraversingQueryContextVisitor 20 | { 21 | @Override 22 | protected final Void mergeResults(List childrenResults) 23 | { 24 | return null; 25 | } 26 | } 27 | --------------------------------------------------------------------------------