Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[RFC] Ops suggested modifications #92

Merged
merged 6 commits into from
Aug 8, 2023
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 42 additions & 85 deletions ADQL.tex
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,11 @@ \subsubsection{Search condition}

\begin{itemize}
\item Standard comparison operators: \verb:=:, \verb:!=:, \verb:<>:, \verb:<:, \verb:>:, \verb:<=:, \verb:>=:
\item Range comparison, \verb:BETWEEN:
\item Case-sensitive string comparison, \verb:LIKE:
\item Null value checks, \verb:IS NULL: and \verb:IS NOT NULL:
\item Non-empty subquery check, \verb:EXISTS:
\item Range comparison: \verb:BETWEEN:
\item Membership check: \verb:IN:
\item Case-sensitive string comparison: \verb:LIKE:
\item Null value checks: \verb:IS NULL:, \verb:IS NOT NULL:
\item Non-empty subquery check: \verb:EXISTS:
\end{itemize}

In addition, some service implementations may also support the optional \verb:ILIKE:
Expand Down Expand Up @@ -2511,9 +2512,9 @@ \subsubsection{Overview}
gavo_convert()
\end{verbatim}

The \verb:ivo: prefix is reserved for functions that have been defined
in an IVOA specification. For example the \RegTAPSpec{} defines the following
functions:
The \verb:ivo: prefix is reserved for functions that have been defined in an
IVOA specification or Endorsed Note. For example the \CatalogueUDF{} defines the
following functions:
\begin{verbatim}
ivo_nocasematch()
ivo_hasword()
Expand Down Expand Up @@ -2551,19 +2552,21 @@ \subsubsection{Metadata}
arg ::= <regular_identifier> <type_name>
\end{verbatim}

\verb:<type_name>: should be one of the terms defined in \SectionRef{sec:types}.

For example, the following fragment declares a user defined function that
takes two \verb:TEXT: parameters and returns an integer, zero or one,
takes two string parameters and returns an integer, zero or one,
depending on the regular expression pattern matching:
\begin{verbatim}
<languageFeatures type="ivo://ivoa.net/std/tapregext#features-udf">
<feature>
<form>match(pattern TEXT, string TEXT) -> INTEGER</form>
<description>
match returns 1 if the POSIX regular expression pattern
matches anything in string, 0 otherwise.
</description>
</feature>
</languageFeatures>
<languageFeatures type="ivo://ivoa.net/std/tapregext#features-udf">
<feature>
<form>match(pattern VARCHAR, string VARCHAR) -> INTEGER</form>
<description>
match returns 1 if the POSIX regular expression pattern
matches anything in string, 0 otherwise.
</description>
</feature>
</languageFeatures>
\end{verbatim}

See the \TAPRegSpec{} for full details on how to use the
Expand Down Expand Up @@ -2720,97 +2723,51 @@ \subsection{Set operators}
\item \verb:INTERSECT:
\end{itemize}

\subsubsection{UNION}
{\footnotesize Language feature :}\\
{\footnotesize \verb|type: ivo://ivoa.net/std/tapregext#features-adql-sets|}\\
{\footnotesize \verb|name: UNION|}\\

The UNION operator combines the results of two queries, accepting rows from
both the first and second set of results,
removing duplicate rows unless UNION ALL is used.

For a UNION operation to be valid in ADQL, the following criteria MUST be met:
For a set operation to be valid in ADQL, the following criteria must be met:
\begin{itemize}
\item the two queries MUST result in the same number of columns
\item the columns in the operands MUST have the same datatypes.
\end{itemize}

In addition, the following criteria SHOULD be met:
\begin{itemize}
\item the columns in the operands SHOULD have the same metadata, e.g. units, UCD, etc.
\item the metadata for the results SHOULD be generated from the left-hand operand.
\end{itemize}
In addition, the columns returned by a set operation SHOULD have the same
metadata, e.g. units, UCD, etc. These metadata SHOULD be generated from the
left-hand operand of the set operation.

Note that the comparison used for removing duplicates is based purely on the
column value and does not take into account the units.
This means that a row with a numeric value of \verb:2: and units of \verb:m:
and a row with a numeric value of \verb:2: and units of \verb:km: will be
considered equal, despite the difference in units.
\begin{verbatim}
2m = 2km
\end{verbatim}
\subsubsection{UNION}
{\footnotesize Language feature :}\\
{\footnotesize \verb|type: ivo://ivoa.net/std/tapregext#features-adql-sets|}\\
{\footnotesize \verb|name: UNION|}\\

The UNION operator combines the results of two queries, accepting rows from
both the first and second set of results.

\subsubsection{EXCEPT}
{\footnotesize Language feature :}\\
{\footnotesize \verb|type: ivo://ivoa.net/std/tapregext#features-adql-sets|}\\
{\footnotesize \verb|name: EXCEPT|}\\

The EXCEPT operator combines the results of two queries, accepting rows that are
in the first set of results but are not in the second,
removing duplicate rows unless EXCEPT ALL is used.

For an EXCEPT operation to be valid in ADQL, the following criteria MUST be met:

\begin{itemize}
\item the two queries MUST result in the same number of columns
\item the columns in the operands MUST have the same datatypes
\item the metadata for the results MUST be generated from the left-hand operand.
\end{itemize}

In addition, the following criteria SHOULD be met:
\begin{itemize}
\item the columns in the operands SHOULD have the same metadata, e.g. units, UCD, etc.
\end{itemize}

Note that the comparison used for removing duplicates is based purely on the
column value and does not take into account the units.
This means that a row with a numeric value of \verb:2: and units of \verb:m:
and a row with a numeric value of \verb:2: and units of \verb:km: will be
considered equal, despite the difference in units.
\begin{verbatim}
2m = 2km
\end{verbatim}
in the first set of results but are not in the second one.

\subsubsection{INTERSECT}
{\footnotesize Language feature :}\\
{\footnotesize \verb|type: ivo://ivoa.net/std/tapregext#features-adql-sets|}\\
{\footnotesize \verb|name: INTERSECT|}\\

The INTERSECT operator combines the results of two queries, accepting rows
that are strictly in both the first and second set of results,
removing duplicate rows unless INTERSECT ALL is used.

For an INTERSECT operation to be valid in ADQL, the following criteria MUST be met:
that are strictly in both the first and second set of results.

\begin{itemize}
\item the two queries MUST result in the same number of columns
\item the columns in the operands MUST have the same datatypes.
\end{itemize}
\subsubsection{Duplicated rows}

In addition, the following criteria SHOULD be met:
\begin{itemize}
\item the columns in the operands SHOULD have the same metadata, e.g. units, UCD, etc.
\item the metadata for the results SHOULD be generated from the left-hand operand.
\end{itemize}
\verb:UNION:, \verb:EXCEPT: and \verb:INTERSECT: remove duplicated rows,
while \verb:UNION ALL:, \verb:EXCEPT ALL: and \verb:INTERSECT ALL: keep all of
them.

Note that the comparison used for removing duplicates is based purely on the
column value and does not take into account the units.
This means that a row with a numeric value of \verb:2: and units of \verb:m:
and a row with a numeric value of \verb:2: and units of \verb:km: will be
considered equal, despite the difference in units.
\begin{verbatim}
2m = 2km
\end{verbatim}
Note that the comparison used for removing duplicated rows is based purely on
the column value and does not take into account the units. This means that a row
with a numeric value of \verb:2: and unit of \verb:m: and a row with a numeric
value of \verb:2: and unit of \verb:km: will be considered equal, despite the
difference in units.

\subsubsection{Operands}

Expand Down